Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1176955
    davidhellmin
    Participant

    i am working on a site for my girlfriend and have come to a stop.
    I fetch all the blog entries (posts) with the grid, but some of them aren´t supposed to be queried. I will query these entries seperatly on another page.

    EDIT:
    I am almost there. Added this so the child themes functions.php, but one post still remains.

    function my_query_args($query_args, $grid_name) {
        if ($grid_name == 'Senaste nytt') {
            // all query parameters can be modified (https://codex.wordpress.org/Class_Reference/WP_Query)
            //$query_args['posts_per_page'] = 2;
            $query_args = new WP_Query( 'cat=-11' );
        }
        return $query_args;
    }
    add_filter('tg_wp_query_args', 'my_query_args', 10, 2);

    EDIT 2:
    Solved it by adding:
    $query_args['cat'] = -11;

    Still woundering what the 10 and 2 represent in the last row?

    #1177075
    Rahul
    Moderator

    Glad you’ve sorted it out!

    Let us know if we can help with anything else.

    Thanks.

    #1178214
    davidhellmin
    Participant

    add_filter('tg_wp_query_args', 'my_query_args', 10, 2);
    Still woundering what the 10 and 2 represent in this row?

    #1178719
    Darshana
    Moderator

    Hi there,

    Those two values represents priority and the number of parameters accepted by the function. For an example, you can refer to this (https://developer.wordpress.org/reference/functions/add_action/).

    Thanks!

    #1179529
    davidhellmin
    Participant

    I see. Thank you for clearing that out 🙂

    #1179854
    Rad
    Moderator

    You’re so much welcome!

  • <script> jQuery(function($){ $("#no-reply-1176955 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>