Forums

Category Posts Widget
Show posts of current category? (10 posts)

  1. vicky515
    Member
    Posted 1 year ago #

    Hi,

    This may not be possible but I figured it's worth asking.
    I only have the sidebar enabled when looking at single articles. Is it possible to modify the "Category Posts Widget" to display articles of the current category only?

    Thanks!

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    link to your site?

    hack to 'category posts widget' plugin; to show posts of the categories of the single post.

    restricted so widget will only show on single post pages.

    new top option 'use post categories' in dropdown; other functionality (hopefully) left intact.

    cat-posts.php:
    http://pastebin.com/PEJ1bwTy

    (no guarantee for function; not widely tested; tested only with post titles, locally xampp wp3.1.1)

  3. kanefulton
    Member
    Posted 11 months ago #

    Very well done, alchymyth. Works a treat on my site.

  4. alchymyth
    The Sweeper
    Posted 11 months ago #

    thanks - nice to get feedback ;-)

  5. yashmistrey
    Member
    Posted 9 months ago #

    hi friend i copy this code and paste into my widget.php

    this error showing

    Fatal error: Cannot redeclare class CategoryPosts

  6. alchymyth
    The Sweeper
    Posted 9 months ago #

    the code is for a particular 'Category Posts Widget' plugin, to replace the main plugin file, and not intended to be inserted into widget.php -
    check, if you have this plugin already activated (?)

  7. yashmistrey
    Member
    Posted 9 months ago #

    can you link that plugin please & please guide me what to do

  8. alchymyth
    The Sweeper
    Posted 9 months ago #

    http://wordpress.org/extend/plugins/category-posts/

    in the plugin folder, replace the content of the file cat-posts.php with the content of the pastebin http://pastebin.com/PEJ1bwTy

    as is said before, the error message 'Fatal error: Cannot redeclare class CategoryPosts' seems to indicate that you possibly use this plugin already;
    in which case go to dashboard -> plugins -> editor; then select the plugin from the list 'Select Pugin to Edit'; and replace the code with the code from the pastebin http://pastebin.com/PEJ1bwTy

  9. yashmistrey
    Member
    Posted 9 months ago #

    hi friend great work !

    but it's working only on single post pages

    not on home page what to do ?

  10. yashmistrey
    Member
    Posted 9 months ago #

    @alchymyth any feedback ?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic