Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Robson.Pi

    (@robsonpi)

    I’m sorry Marcin – I didn’t mean that I wrote the plugin.
    As I wrote in first post I’m “copy&paste” guy.
    I wouldn’t be able to write something like that.

    I should write that “I used” code of your plugin.
    The truth is that I looked through so many posts about limiting the wp_query that I couldn’t find out who was the author of the code.

    Once againt – sorry for that.
    And thank You for great plugin.

    Thread Starter Robson.Pi

    (@robsonpi)

    Thanku you for you attantion!
    I’m OK for now 🙂 & marking topic as resolved.

    Thread Starter Robson.Pi

    (@robsonpi)

    While cooking dinner I thought about another vertion of filtering main loop and made solution mostly by accident 🙂
    It’s how it worked for me.

    In settings > reading “Front Page” as Home and “Post page” as blog.
    I used Post-in-page plugin (https://ww.wp.xz.cn/plugins/posts-in-page/) pulling post from selected category on static Home.

    I also made plugin:

    <?php
    /*
    Plugin Name: Limit homepage to display a single Category
    */
    
    add_action('wp_head', 'iworks_only_one_category');
    function iworks_only_one_category()
    {
        if ( is_front_page() ) {
            global $wp_query;
            $wp_query->query('cat=10');
        }
    
    	if ( is_home() ) {
            global $wp_query;
            $wp_query->query('cat=-10');
        }
    }
    
    ?>

    After turning the plugin things work as I want.

    I tried this plugin earlier, but when settings > reading “Front Page” was set as empty (no page was set) it didn’t work.

Viewing 3 replies - 1 through 3 (of 3 total)