Welcome to PressWork!

Want to ask a question or join the discussion? Great! Join now.

In this Discussion

Presswork Update causing double posts
  • Hi, just updated the Presswork theme an noticed the posts are now doubling-up. Not all but most are. Here is a link to the site:
    http://www.debney.vic.edu.au/

    Can you advise of a fix for this?
  • cbavotacbavota
    This answer was Accepted.
    Are you using a child theme? The post loop has been rewritten for efficiency so any child theme based on version 1.0.3 will have issues. I am going through it now to figure out an easy solution.
    image Senior Developer & Co-Founder of PressWork
  • Yes, I'm using a child theme.
  • If you look over the /admin/actions.php file you will see that the post loop has now been separated into a post header, post content and post footer function. This was done to make it easier to rewrite those functions without having to rewrite the entire loop.

    So in order to remove the double posts on your child theme, you would need to add the following to your actions.php file:
    remove_action('pw_index_post_middle', 'pw_post_header');
    remove_action('pw_single_post_middle', 'pw_post_header');
    remove_action('pw_index_post_middle', 'pw_post_content', 11);
    remove_action('pw_single_post_middle', 'pw_post_content', 11);
    remove_action('pw_single_post_middle', 'pw_post_footer', 12);
    remove_action('pw_page_post_middle', 'pw_post_footer', 12);
    remove_action('pw_category_post_middle', 'pw_post_content', 11);
    remove_action('pw_category_post_middle', 'pw_post_header', 10);
    remove_action('pw_search_post_middle', 'pw_post_content', 11);
    remove_action('pw_search_post_middle', 'pw_post_header', 10);
    remove_action('pw_author_post_middle', 'pw_post_content', 11);
    remove_action('pw_author_post_middle', 'pw_post_header', 10);
    remove_action('pw_archive_post_middle', 'pw_post_content', 11);
    remove_action('pw_archive_post_middle', 'pw_post_header', 10);


    That is a quick fix for the issue. If you rebuilt your child theme from scratch you would not need to do this since you would be working with the new functions. The real issue is that your loop contains header, content and footer in one function. If you didn't want to use the quick fix you would have to remove the header and footer from your content and then rewrite those functions accordingly.
    image Senior Developer & Co-Founder of PressWork
  • Thanks for that. It has solved the double posts. Only issue that now occurs is that the posts don't show when clicked-on. eg.
    http://www.debney.vic.edu.au/blog/2012/02/20/from-the-principal/
    I assume the answer lies in one of those lines of code supplied but I'm not sure which... Are you able to point me in the right direction?
  • Hold that, was able to work it out. Removed these 2 statements:
    remove_action('pw_single_post_middle', 'pw_post_header');
    remove_action('pw_single_post_middle', 'pw_post_content', 11);
    All looks good now. Thanks for looking into this for me ;)