Archived

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

  • 0

Resolved Comments On Front Page And Hidden

Question

Posted · Report post

Hi. I am running Pagelines 2.3.5 and am having issues with 2 comment related items.

1. Getting comments to "hide" then when the user clicks on the link it appears

2. Getting comments attached to posts on the front page.

For #1, I am using the WordPress ajax comments inline plugin. The instructions here http://farlee.info/a...ine-plugin.html say to put the below code into the loop. I have placed it at the end of comments.php, removing the last 2 divs at the end and replacing it with the below.


<?php show_hide_comments_link(); ?>

	 </div><!-- .entry-utility -->

<?php display_ajax_comments(); ?>

</div><!-- #post-## -->

The issue I have now is that the plugin functions as it should, but I now have 2 comment boxes. One is the hidden one, and one is the visible WP comment box. I dont know how to disable one and keep the other. For #2, this has been a real trick. I have looked at other forums that say to put

<?php comments_template(); ?>

in the index.php file. Perhaps I just dont know where to put it in Pagelines. I have tried a few different places like comment.php to no avail. I tried to do a hook in function.php with the "pagelines_loop_after_post_content" hook, but to be honest, I am sure I flubbed it up. I dont understand hooks that well and the documentation is slim.

I am sure its an obvious fix but I just cant see it.

Share this post


Link to post
Share on other sites

23 answers to this question

Posted · Report post

Please forgive my misunderstanding. It seems you want the comment form to appear on the homepage under each post. Is this correct?

If so, we have to look to WordPress, which actually controls the comment form for the most part. It is incredibly uncommon for the comment form to be on the homepage as it's not considered attractive or useful there.

I did find this post on WordPress.org:

http://wordpress.org/support/topic/show-comments-on-home-page-posts

The method to implement that two year old code would be to use the Action Map plugin we provide to identify the location of where you want the form to appear. Presumably below each post listed.

Shortly, we'll have a fantastic new hooks plugin that allows you to drop the code into a form and it writes the code for you. But if you can't wait a few days, once you know the proper hook, you can craft it using the PageLines Customize plugin which has a functions.php that you should use for editing.

Properly placing it in the correct hook, should, in theory, make the code provided in that link work.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi Rob,

You are correct, we are looking to get comments on the front page under each post. Using the WP default themes, it is very easy to do. In the image above, you can see it functioning how we want it to. It has a link to "Leave a reply" which then activates the AJAX commenting form. So it is hidden unless needed. And if there are existing comments, it says "View replies" and upon click, the commenting structure drops down. We are trying to get this same functionality with Pagelines.

We have tried to do this through hooks. But it seems that any change to the functions.php results in a crashed site. I am not a very accomplished coder, so I am a bit blind here but we identified "pagelines_loop_after_post_content" as the hook to use. We then tried to call the very function you referenced. This is in an earlier post. But to recap, we placed:


add_action('pagelines_loop_after_post_content', 'frontpage_comments');

function frontpage_comments() {

<?php

$withcomments = 1; // force comments form and comments to show on front page

comments_template();

?>

}

...in the functions.php of the child theme. This caused a crash. We then removed the last closing mark and still had a crash (crash meaning, the site went blank as well as the backend and we had to FTP in and revert the functions.php to bring it back). This code was our stab in the dark as I'm not a coder. UPDATE: I tried the same thing with the Customize plugin. I went back the the pagelines parent theme. The Customize plugin is active. When I use the EDIT to change the code, the css file states it is (active) at the top of the screen but the functions.pho states (inactive). It looks like a better code option would be:

add_action('pagelines_loop_after_post_content', 'frontpage_comments');

function frontpage_comments() {

$withcomments = 1;

comments_template();

}

But how do I make the functions.php in the Customize plugin active. The other two files (pagelines-customize/style.css and pagelines-customize/pagelines-customize.php) report ACTIVE but the pagelines-customize/functions.php file reports INACTIVE.

Share this post


Link to post
Share on other sites

Posted · Report post

UPDATE: Using the following code, I am able to get it to display if there are Comment or not with the Customize plugin. So the hook is in the right place. We're close folks!


add_action('pagelines_loop_after_post_content', 'frontpage_comments');

function frontpage_comments() {

comments_popup_link('No Comments', '1 Comment', '% Comments');

}

Share this post


Link to post
Share on other sites

Posted · Report post

Hi AJ,

Is this issue now resolved ?

Share this post


Link to post
Share on other sites

Posted · Report post

HI,

That plugin hasn't been updated in over a year, I recommend you contact the developer for assistance to make sure its still supported and works with the latest version of Wordpress. Also, PageLines doesn't have the structure of a usual Wordpress theme. If you were were to implement this plugin, you would most likely need to use both hooks and filters.

We do not recommend editing the core files, as when an update is released, your code edits will be overwritten.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi there,

I've found the below links which might be able to help you somewhere, but I'm not sure how'd you'd implement them into the child theme using a hook. The list of Pagelines Hooks are here, http://api.pagelines.com/hooks if you know the php of what you're editing then you might be able to work the info below into the hook, but as we're not trained coders we wouldn't be able to advise on the process.

If no one else comes forward with a response you might need to speak to a Pl Pro who can script this in for you somewhere, if you need to you can check them out at www.pagelines.com/pros/

http://wordpress.org/support/topic/show-comments-on-home-page-posts

http://wordpress.org/support/topic/twentyten-add-comments-form-to-posts-on-the-index-page

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks James. I've seen those links. If I'm not mistaken, those would require changes to the core Pagelines code, thus making it unupgradeable. I've gone through the list of hooks and found what I think I need. I just don't know how to implement it. I mentioned the hook in the first post, I guess I will see if someone can help with the code. It should not be difficult. An "add action" followed by a function encoding the php to show the comment on all posts should do it. Just need a little assistance there.

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Rob. That doesnt really help much. I am aware of widgets and options. What I need is basic commenting functionality on the front page. This should be a very simple task but has proven to be elusive. I may have to go to another theme system for this one site. I'm surprised no one else has needed this functionality.

Would upgrading my account to Developer or Plus help get this issue resolved? Would there be additional people who could help if I updated and submitted a ticket?

Share this post


Link to post
Share on other sites

Posted · Report post

I don't think upgrading would make a difference - the issue would still be the same. Have you accomplished something like this (on a posts page) on a WP site before?

Share this post


Link to post
Share on other sites

Posted · Report post

I just meant would upgrading give me access to developers who can help out. When I use the Twenty Eleven theme, this works exactly as I want (see image below). Comments are added to every post on the front page. There is a "Leave a Reply" link that drops an AJAX Comments section. This is the JetPack comments plugin. It does not work on PageLines as described above.

oo_screen_twenty_eleven.png

Share this post


Link to post
Share on other sites

Posted · Report post

Hi Catrina,

The posts that James referred to require editing the post loop and/or the WordPress index.php file. It looks like the part of the loop that needs to be edited resides in the class.posts.php which is a part of the core files, not an editable section. Maybe I am wrong here. The section for the postloop does not allow me to edit parts of the loop, just functions around the calling of the loop as far as I can tell.

Which brings me back to some kind of hook. Is anyone on the forum experienced with hooks?

It looks like I should be doing something like:


add_action('pagelines_loop_after_post_content', 'frontpage_comments');

function frontpage_comments() {

<?php

$withcomments = 1; // force comments form and comments to show on front page

comments_template();

?>

}

But when I add code to the function.php, the whole site goes blank and only the header loads.

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Danny,

I went ahead and installed the Base Child theme. I can find a new plugin to do the drop down comment, so lets forget about that part for a second. How about getting the comments to appear on the front page? What hooks/filters do I need to implement with the Child Theme to make this work?

Share this post


Link to post
Share on other sites

Posted · Report post

Hi again, no unfortunately you wouldn't get to deal with the developer team if you upgraded to dev/plus edition.

The only way would be to hire a pl pro, or check Odesk to see if any developers post for private scripting jobs, or if you're interested in creating products/themes for the store look into joining the junto group http://developer.pagelines.com/apply/

Again, I'm not a coder but looking at your code above it looks as if the php isn't closed off correctly, I don't think the last closing bracket } is required.

Share this post


Link to post
Share on other sites

Posted · Report post

If your front page is a static regular page, you should be able to activate the Comments section in Drag & Drop in Template 1 (or Template 2 or 3 - whichever one) and set that Template 1 as the template for your front page in the page editor.

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Catrina,

I have tried this to no avail. Here was my process:

  • Modify a template to contain the POST LOOP, COMMENTS, and PAGINATION.
  • Create a PAGE with no content, assigned the newly created TEMPLATE, ensured that everything is ON that should be
  • Assigned the Front Page to a Static Page

Here is where is goes wrong. If I assign it to a Front Page: "newly created page", the content is now Totally blank. Firebug shows me I get all the header information but the body is completely empty. If I use Posts Page: "newly created page", I get the correct post loop but no comments. On the status bar, I see it has overwritten the template I chose and uses Template: BLOG, which has no comment option.

Share this post


Link to post
Share on other sites

Posted · Report post

We can mark it as resolved. Hopefully it will help others too.

Share this post


Link to post
Share on other sites

Posted · Report post

The topic was marked as resolved.

Share this post


Link to post
Share on other sites

Posted · Report post

Depending on the commenting plugin you use, some have a widget to display recent comments. For example, I use Disqus and there's a Disqus Widget for just the purpose you seek.

You may want to consider using a FaceBook or Twitter integration for comments, either of which have tons of available plugins/widgets to display recent comment postings. Also, you'd get the added benefit of those comments being posted to your FB or Twitter account helping to drive more traffic to your site.

Share this post


Link to post
Share on other sites

Posted · Report post

Any other thoughts on this? Does anyone know how to use hooks and filters to get comments on the front page with Pagelines?

Share this post


Link to post
Share on other sites

Posted · Report post

When setting up your static homepage, does the Comments section work? Are you activating it Content Area?

Share this post


Link to post
Share on other sites

Posted · Report post

If the static homepage is set up as the FRONT PAGE option, then I get comments but no posts. When I do it as the POSTS PAGES option then I get the posts but no comments.

When using the Front Page option, setting it to the page I created for a static page, it shows the template I chose in the status bar. Content and Post Loop are enabled in the template but do not show on the page.

When setting it as a posts page, it does not set to the template I specified in the PAGE setup. It defaults to the BLOG template. In the BLOG template in the Drag and Drop part of Pagelines, there is no option to drag and drop comments into the template.

I would be happy to PM you the login details to take a look. I am pretty sold on Pagelines and am using it in at least 5 sites. I am hoping I dont have to move away from it in order to get this to work.

Share this post


Link to post
Share on other sites

Posted · Report post

Yeah, that was just my stab at it. Even removing the closing bracket and placing the code in the functions.php in the child theme breaks the site. I have to FTP back in, and revert the functions.php back to the non-modified state.

Share this post


Link to post
Share on other sites