WordPress.org

Ready to get started?Download WordPress

Forums

List category posts
[resolved] List category posts for home page (non-static)? (2 posts)

  1. daitya
    Member
    Posted 3 years ago #

    Hi, using WP 3.0.4, theme: Twentyten (child).

    Can List Category Posts plugin work for a non-static home page?

    Want to call posts from specific categories to specific divs on my home page. I downloaded List Category Posts plugin, activated it, and then typed the following: [catlist name=sci-tech orderby=date numberposts=1 date=yes author=yes excerpt=yes catlink=yes] into one of the divs inside index.php. But on viewing the home page, the code appears, and no post.

    I even tried <?php echo do_shortcode('[catlist name=sci-tech orderby=date numberposts=1 date=yes author=yes excerpt=yes catlink=yes]'); ?>, but that returned an error:

    Catchable fatal error: Object of class WP_Error could not be converted to string in /Users/das/Documents/Websites/Bhaktivedantas-dev/public_html/wp-content/plugins/list-category-posts/list_cat_posts.php on line 84

    Can anyone help with how to implement this plugin on home page? Or point me to another solution for what I want to accomplish? Many thanks!

  2. daitya
    Member
    Posted 3 years ago #

    TIL that this plugin will not work on the index.php or non-static home page or theme template pages. It is designed to work from within theme editor created pages or posts.

    That said, however, I did get it to work by a run-around:

    a) added query below in home page in designated text area:

    <?php $the_query = new WP_Query('pagename=whatever');
    while ($the_query->have_posts()) : $the_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <?php the_content(); ?>
    <?php endwhile; ?>

    b) created new page named as per the value assigned to pagename above, complete with the xhtml and images (inserted using the theme page editor) that I wanted to appear in the designated home page text area.

    c) inserted the List Category Posts plugin call:
    [catlist id=1]
    Ok, so my version of it included a few more parameters :)

    d) selected single-column layout (no sidebars), disabled comments, trackbacks, pings. Published page. Next, edited out the page title, but left permalink intact.

    c) Went to menus, made certain that menu selected was sitewide navigation (this is a multisite network enabled installation) and that the default did not automatically add new pages to menu. Verified that the page did not appear in the menu.

    And VOILA! The posts from that category are showing up where I want them on the home page.

    Now, if I can only figure out how to style the plugin's output. That will have to be a different thread.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic