WordPress.org

Ready to get started?Download WordPress

Forums

Main Page, News from a specific category (12 posts)

  1. parisgv
    Member
    Posted 9 years ago #

    Hi, my site is http://www.justshannen.com

    I have read previous threads with same "problem" but no solution. Well, I would like on my main page to appear news only from a specific category and not from all categories. Thanks!

  2. Kafkaesqui

    Posted 9 years ago #

    Check out this plugin:

    http://www.semiologic.com/projects/opt-in-front/

    To customize it, locate the variable $sem_main_cat in it and change it's value to the category slug for the category you want to display (for example, 'updated-news').

  3. parisgv
    Member
    Posted 9 years ago #

    ok, this doesnt helps me, something easier?

  4. ColdForged
    Member
    Posted 9 years ago #

    Unfortunately that's about as easy as it will get. Which part are you having trouble with?

  5. parisgv
    Member
    Posted 9 years ago #

    what do you mean? i just want to appear news from ONE category on main page, not from all. i dont want everything i write (post) to appear on main page :)

  6. ColdForged
    Member
    Posted 9 years ago #

    Maybe I wasn't clear... we understand what you want. Kafkaesqui provided a method to do what you want but you said that "it doesn't help you" and asked for something easier. I said that's as easy as you're going to get in WordPress, and asked which part of Kafka's recommendation you were having difficulty either understanding or getting to work.

  7. binarymoon
    Member
    Posted 9 years ago #

    I used the query_post command to get the first post from any category that wasn't my links category to show on my home page.

    I worked out how to do this using the article on IfElse.

    http://www.ifelse.co.uk/archives/2005/04/08/query_posts-redux/

    All you need to do is

    <?php query_posts('cat=CATEGORY_NUMBER');?>

    Replacing category number with the number of the category you want to display on the homepage. You then do the loop as normal to display the rest of your blog.

    I added posts_per_page=1 to only show the first post but obviously you don't have to do that.

  8. parisgv
    Member
    Posted 9 years ago #

    well, i activated the puglin http://www.semiologic.com/projects/opt-in-front/

    ive made a new category called Movie Reviews (i dont wanna appear this cat. posts at main page) and i have also, accoring the script rules, on the php file changed the name from blog, to

    if ( !isset($sem_main_cat) )
    $sem_main_cat = "2";

    but same things happens, news from all categories appear on main page, when i post something to ID: Movie Reviews which is number 11 it appears on main page, BUT i have setted only ID: "2" to appear why?

  9. Denis de Bernardy
    Member
    Posted 9 years ago #

    I'm aware it could be more simple to configure. Namely, I yet to make the admin panel, for users to configure the settings from the admin area. I know it's on several of the plugin's users' wish list. And it is on my to do list. But to be frank, it's like... very low priority.

    The plugin checks if you've a category with the appropriate slug, and if not, it fallbacks to normal blog mode. thus, if you've no category with a slug of '2', it will ignore the call.

    Just create a category called 'News' and use:

    if ( !isset($sem_main_cat) )
    $sem_main_cat = "news";

    Alternatively, use something like:

    if ( !isset($sem_main_cat) )
    $sem_main_cat = "updated-news";

    Alternatively still, create a category called 'Blog' and use the default settings.

    If someone has more time on his hands than I do, I suggest the following as an admin interface: Replace the manage category panel, then add a column called 'main category' and a radio at the end of each line. A less elegant way to do it would be to make a straightforward option panel with a select box. Email the code to denis "@" semiologic.com and I will add it to the plugin.

  10. dolmarit
    Member
    Posted 9 years ago #

    Hi All

    Maybe you can use the following.
    Plugin Name: Customizable Post Listings
    Plugin URI: http://www.coffee2code.com/wp-plugins/
    Author: Scott Reilly

    I use it as a plugin and copied the file to a new PHP file for testing in the directory where my theme is located.
    I removed the following lines just for testing purposes.
    The copyright is still in the file ofcourse.

    /*
    Plugin Name: Customizable Post Listings
    Version: 1.1
    Plugin URI: http://www.coffee2code.com/wp-plugins/
    Author: Scott Reilly
    Author URI: http://www.coffee2code.com
    Description: Display Recent Posts, Recently Commented Posts, Recently Modified Posts, Random Posts, and other post listings using the post information of your choosing in an easily customizable manner. You can narrow post searches by specifying categories and/or authors, among other things.

    */

    Now don't use it as a plugin!! if you already do.
    Rename all c2c to c4c for example in the new PHP file.

    In your index.php copy the following line outside the loop.
    <?php include ('yourname.php'); ?><?php c4c_get_recent_posts (1); ?>

    In your new PHP file you find the following lines

    function c4c_get_recent_posts ($num_posts = 5,
    $format = " %post_URL% %post_content%
    ",
    $categories = '',

    Change the lines in this

    function c4c_get_recent_posts ($num_posts = 5,
    $format = " %post_URL% %post_content%
    ",
    $categories = '8',

    And you see the the latest news from category 8 as an example.
    All you have to do next is maybe make a few changes in your CSS file.
    Hope this is helpfull.

    Martin

  11. dolmarit
    Member
    Posted 9 years ago #

    small correction the first lines look like this.

    function c2c_get_recent_posts ($num_posts = 5,
    $format = " %post_URL% ",
    $categories = '',

    Change the lines in this

    function c4c_get_recent_posts ($num_posts = 5,
    $format = " %post_URL% %post_content% ",
    $categories = '8',

    I was a little to fast with copy and paste.

    Martin

  12. Konquest
    Member
    Posted 8 years ago #

    I'm currently using the opt-in front plugin and it's proven quite nice...

    However, I'd like to know if it's possible to still show the "blog" category in the sidebar. I'm using the wp_list_cats function to list all my categories, but this plugin overrides this and hides my "blog" category.

    It could be really useful for navigation purposes.

    Thanks a lot.

Topic Closed

This topic has been closed to new replies.

About this Topic