Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Archives Page-How can I add the date before the post title when using "postbypost"?


  #1  
Old Jun 10, 2009, 03:50 PM
fromtheranks
 
149 posts · Apr 2009
Dev Env't: XP Pro SP3, IIS 5.1, MySQL 5.1, PHP 5.2.x, WP 2.7.1, Atahualpa 3.3.3, IE 7, FF 3.0.x
I'm setting up my Archives page now and, for the time being, I plan on just using: "Show Archives by Date?" = Yes, and "Archives by Date: Type" = postbypost. (I won't have hundreds of posts for the foreseeable future so, at the moment, this approach makes sense. )

But, I would like to change the following on the Archives page:

1. add the Post Date after the the bullet and before the Post Title ... without having to "go outside" to a plugin.

2. get rid of the Byline on the Archives page ... only ... it doesn't make sense to me to have it here.

Thanks in advance.

P.S. I've attached a screen shot if that will help.

Last edited by fromtheranks; Jun 13, 2009 at 08:10 PM.
  #2  
Old Jun 10, 2009, 11:24 PM
fromtheranks
 
149 posts · Apr 2009
Dev Env't: XP Pro SP3, IIS 5.1, MySQL 5.1, PHP 5.2.x, WP 2.7.1, Atahualpa 3.3.3, IE 7, FF 3.0.x
Okay, I think I'm beginning to get the hang of this theme ... I've solved one issue, the one of getting rid of the Byline on the Archive (and Sitemap) page.

I did some more research on WordPress for conditional tags and here too -- where I ran across this code example: http://forum.bytesforall.com/showpos...9&postcount=12

Using that logic, I made the following mod in my ..\themes\atahualpa333\index.php:

Code:
<?php   if ( !is_page('Archives') && !is_page('Sitemap') ) { ?> // modified 6/10/09 to drop byline from archives and sitemap pages
			<?php bfa_post_byline(); // Post Byline: To edit the output, see functions/bfa_post_parts.php ?>
<?php } ?>
And it worked!

Note: I used the literal page titles because I suspect that when I move my dev site over onto my host's server the Page ID's could very well change.

However, I've had no luck so far on resolving my other "issue" on the Archive page: adding a date before the title when using "postbypost". I'm open to suggestions and hints for that one.

Thanks in advance.
  #3  
Old Jun 10, 2009, 11:37 PM
fromtheranks
 
149 posts · Apr 2009
Dev Env't: XP Pro SP3, IIS 5.1, MySQL 5.1, PHP 5.2.x, WP 2.7.1, Atahualpa 3.3.3, IE 7, FF 3.0.x
Minor oops in my code. I added the remark incorrectly -- it showed up on the Home page.

This works:

Code:
<?php   if ( !is_page('Archives') && !is_page('Sitemap') ) { // modified 6/10/09 by DPH to drop byline from archives and sitemap pages ?> 
			<?php bfa_post_byline(); // Post Byline: To edit the output, see functions/bfa_post_parts.php ?>
<?php } ?>
I add such remarks so I can find what I tweaked if I need to go back ... I just need to add them in the right place.
  #4  
Old Jun 12, 2009, 02:09 PM
fromtheranks
 
149 posts · Apr 2009
Dev Env't: XP Pro SP3, IIS 5.1, MySQL 5.1, PHP 5.2.x, WP 2.7.1, Atahualpa 3.3.3, IE 7, FF 3.0.x
As an update, the logic for the look of the archives page content is definitely coming from wp_get_archives( ). So there doesn't seem to be a "simple" mod that I can make via Atahualpa. That makes sense now.

However.

Has anyone figured out how to "tweak" wp_get_archives( ) so, when using "postbypost" I can get a list that looks something like this?
  • <post date> <post title>

Thanks in advance.
  #5  
Old Jul 18, 2009, 08:06 AM
jankph
 
93 posts · Jul 2009
ATA 3.6.4 and WP 3.1
Quote:
Originally Posted by fromtheranks
Has anyone figured out how to "tweak" wp_get_archives( ) so, when using "postbypost" I can get a list that looks something like this?
  • <post date> <post title>
I'm looking for something like this, too. Is it not possible?
  #6  
Old Jul 22, 2009, 11:47 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
wp_get_archives has "before" and "after" parameters but those are meant to be used for HTML. To include the post date try a plugin such as http://www.ardamis.com/2007/06/25/ad..._get_archives/
  #7  
Old Jul 22, 2009, 05:34 PM
jankph
 
93 posts · Jul 2009
ATA 3.6.4 and WP 3.1
I downloaded and activated the plugin, but the instructions said

Edit your theme, replacing wp_get_archives('type=postbypost') with ard_get_archives();

Now, where is that? Supposedly in wp-includes/general-template.php....but I cannot find anything that looks like that in MY general-template.php...or am I wrong?
  #8  
Old Jul 23, 2009, 08:52 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
Try replacing

PHP Code:
<?php /* Archives Pages. Displayed on a specific static page, if configured at ATO -> Archives Pages: */
bfa_archives_page('<div class="archives-page">','</div>'); ?>
in ATO -> Style & edit CENTER COLUMN -> Content BELOW the LOOP

with

PHP Code:
<?php if ( is_page('Title of Archive page') ) {
if ( 
function_exists('ard_get_archives') ) {
ard_get_archives();
}} 
?>
  #9  
Old Jul 25, 2009, 10:52 AM
fromtheranks
 
149 posts · Apr 2009
Dev Env't: XP Pro SP3, IIS 5.1, MySQL 5.1, PHP 5.2.x, WP 2.7.1, Atahualpa 3.3.3, IE 7, FF 3.0.x
Thanks for the tip on the plugin: http://www.ardamis.com/2007/06/25/ad..._get_archives/ and modifying ATO --> BELOW the LOOP.

However. I haven't upgraded to WP 2.8.x or Atahualpa 3.4.x yet so I couldn't do the minor surgery as suggested.

But. I did take the idea from the plugin's code (shown at the above link) and made that work for me on Atahualpa 3.3.3 by directly modifying ..\wp-includes\general-template.php.

[I know it isn't a good idea to modify core code but I haven't had time to do the upgrades so this will work until I do.]

Here's the origina "postbypost" code (the three dots indicate omitted code):

Code:
} elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
...
        if ( $arcresults ) {
            foreach ( (array) $arcresults as $arcresult ) {
                if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
                    $url  = get_permalink($arcresult);
                    $arc_title = $arcresult->post_title;
                    if ( $arc_title )
                        $text = strip_tags(apply_filters('the_title', $arc_title));
                    else
                        $text = $arcresult->ID;
                    $output .= get_archives_link($url, $text, $format, $before, $after);
Here's the tweaked code (changes in red). This puts the date in front of the title with a colon and space in between:
Code:
} elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
...
        if ( $arcresults ) {
            $beforebefore = $before; // new 7/25/09 by DPH - see: www.ardamis.com/2007/06/25/adding-the-post-date-to-wp_get_archives/
            foreach ( (array) $arcresults as $arcresult ) {
                if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
                    $url  = get_permalink($arcresult);
                    $arc_title = $arcresult->post_title;
                    $arc_date = date('m/d/Y', strtotime($arcresult->post_date));  // new 7/25/09 by DPH
                    $before = $beforebefore . '<span class="recentdate">' . $arc_date . '</span>' .': ';  // new 7/25/09 by DPH
                    if ( $arc_title )
                        $text = strip_tags(apply_filters('the_title', $arc_title));
                    else
                        $text = $arcresult->ID;
                    $output .= get_archives_link($url, $text, $format, $before, $after);
If you wish to have the date afterwards modify the logic per the sample code on the plugin site above.

Note: for brevity's sake, the closing brackets have been omitted from the above sample, so if you wish to make a similar tweak don't copy this code verbatim; instead, backup general-template.php and then add the three lines of code in red placing them where shown.

You can see an example of this in use at my site: www.fromtheranks.com. Click on the "Archives" tab on the Page Bar.

Hope this helps.

Last edited by fromtheranks; Jul 25, 2009 at 11:05 AM.

Bookmarks

Tags
archives, postbypost

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to post on 2 seperate "Pages" or "Cats" TPR Atahualpa 3 Wordpress theme 18 Aug 4, 2010 09:24 PM
request: please add "links.php" page template. dhani Atahualpa 3 Wordpress theme 0 May 22, 2009 04:36 AM
How to add "News" title on the main page? paul2008 Atahualpa 3 Wordpress theme 9 May 4, 2009 06:07 AM
How to style "post icon" and "post comments" text Whatsthatcat? RSS, Feeds & Subscribing 3 Apr 1, 2009 10:41 AM
Flexx theme - How to change my "List Category or Archives" to "List Titles ONLY" ?? idaks01 Post-Kicker, -Byline & -Footer 0 Mar 28, 2009 06:22 PM


All times are GMT -6. The time now is 07:50 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.