Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #492512

    Hello,

    Is there a way to disable Posts from showing anywhere on the site and only accessible by direct link?

    #492850

    Hey w3developing!

    Please add following code to Functions.php file in Appearance > Editor

    function avia_exc_post($query) {
        if ($query->is_search) {
            $query->set('cat','5,9');
        }
        return $query;
    }
    add_filter('pre_get_posts','avia_exc_post');

    5 and 9 here are category ID’s. You can give additional category to your posts that you would like to exclude from search and replace the ID’s in the code.

    Regards,
    Yigit

    #494577

    Ok, thanks but this does not solve the problem. For example see the links in the private post.

    #494583

    I found this code for the accordion:

    ‘post__not_in’ => (!empty($no_duplicates)) ? $avia_config[‘posts_on_current_page’] : array(),

    Is there a hook to replace this query or modify it to hide specific posts from the image accordion?

    #497382

    Hello?

    #498246

    Hi!

    Try to use this:

    function avf_accordion_entries_query_mod($query, $params) {
        $query['category__not_in'] = array( 27, 18 );
        return $query;
    }
    add_filter('avf_accordion_entries_query','avf_accordion_entries_query_mod');

    Again, you can add a unique category to the posts that you want to exclude. Use the id of that category to replace 27 and 18 in the example above.

    Best regards,
    Ismael

    #501358
    #502798

    Hi!

    You can try using the “avf_magazine_filter” on line 255 in the /enfold/config-templatebuilder/avia-shortcodes/magazine.php file for that. Are you trying to exclude these posts from all queries?

    Cheers!
    Elliott

    #504368

    Can you give me an example of using the magazine filter?

    #504473

    Hey!

    It’s basically the same as the first filter. Example:

    function avf_magazine_entries_query_mod($query, $params) {
        $query['category__not_in'] = array( 27, 18 );
        return $query;
    }
    add_filter('avf_magazine_entries_query','avf_magazine_entries_query_mod');

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.