Jump to content

Archived

This topic is now archived and is closed to further replies.

gtg468y

Hook for pagelines_loop_after_post_content appears on other pages

Recommended Posts

gtg468y

I'd like to add facebook and twitter links after the blog posts.  My blog page shows the full-length posts (not excerpts). 

 

I found the hook pagelines_loop_after_post_content and added the links and got it figured it out, and it looked great!  Then I looked at the rest of the website, and that hook appeared on all the other pages.  I thought it would only appear for the blog, but it was on my Home Page and other pages.  I checked the Drag & Drop feature, and it indicates all Content Areas have "PostLoop" section, which is defined as content and post information.  So does that mean I can't differentiate between a blog post and general page content? 

 

How do I just have that hook show only on the blog page and not any other page? Thanks!

Share this post


Link to post
Share on other sites
Danny

What you do could do is try adding one of the Wordpress functions to your code. You can no longer use the is_post() as this is now deprecated. You could try:

 

http://codex.wordpress.org/Function_Reference/have_posts

http://codex.wordpress.org/Function_Reference/is_page

 

If using is_page trying adding ! to it which is not in PHP for example:

 

!is_page()

 

You can find a full list here - http://codex.wordpress.org/Function_Reference/


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
gtg468y

Thanks!  But I still can't figure out how to put the code. 

 

This is what I have, and there's an error somewhere, I've tried different things, but it's either showing on all pages still or completely failing:

 

add_action('pagelines_loop_after_post_content','comments');
 function comments(){
 ?>
   <?php if ( is_page('blog) ) {
 <div class="metabar"><span class="post-comments2">
<a href="<?php global $post;
$link = get_permalink( $post->ID );
echo do_shortcode( "[post_comments]");
echo do_shortcode( sprintf( '[like_button url="%s"]', $link ) );
 echo do_shortcode('[twitter_button]'); ?><a href="#contact_form_pop" class="fancybox">Contact Us</a>
<div style="display:none" class="fancybox-hidden">
     <div id="contact_form_pop"><?php echo do_shortcode('[contact-form-7 id="271" title="Contact form 1"]'); ?></div></div>
</a></span>}
?>
<?php }

Share this post


Link to post
Share on other sites
Danny

Hooks are considered an advanced customization so we do not provide support unfortunately to users created code. Therefore, you will need to see our hooks doc for assistance here - http://docs.pagelines.com/advanced/hooks


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
gtg468y

I got the hook to work, but it's showing on all pages.  I can't get it to show on the blog only using is_page.

Share this post


Link to post
Share on other sites
Danny

Thats because your blog if it is set as a static page, is no longer considered a page to my knowledge.

 

You can probably try is_home()

 

You're best asking this question on the Wordpress support forums.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
gtg468y

Yes! is_home did the trick!

 

Thanks for your help!!!

Share this post


Link to post
Share on other sites
Danny

No problem.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

×