homepage Welcome to WebmasterWorld Guest from 54.167.244.71
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

    
How to display sticky post on the bottom of the main page?
tnet21




msg:4493948
 7:56 pm on Sep 11, 2012 (gmt 0)

Is there any way to display it on the bottom instead?

I am using Twenty Eleven 1.4, and the code is as follows:

<?php if ( is_sticky() ) : ?>
<hgroup>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<h3 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h3>
</hgroup>
<?php else : ?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php endif; ?>

I changed it to:

<?php if ( !is_sticky() ) : ?>

<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>


<?php else : ?>

<hgroup>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<h3 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h3>
</hgroup>

<?php endif; ?>

...but it doesnt make a difference. The sticky post still stays on the top. Is thery any way to move it to the bottom of the main page and make it stay there. What makes sticky posts stay on the top (what code and where is it located) of page one, instead of, lets say in the middle of page 3?

Thank you.

 

lorax




msg:4494003
 10:47 pm on Sep 11, 2012 (gmt 0)

I'm not sure how WP handles sticky posts but if you want a single post to display at the bottom of the top page then you can use this code:


<?php
$my_id = 34;
$post_id_34 = get_post($my_id);
echo $post_id_34->post_title;
echo $post_id_34->post_content;
?>


Simply calls a single Post by it's ID (34 in the example) and outputs the title and content. Add your HTML & CSS as you wish.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WordPress
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved