Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1138907

    Hello
    I’ve selected 2 posts that i would like to have on top for a period of time
    I have frontpage with ‘ magazine ‘ element and few categories selected to show

    so i have All / Category 1 / Category 2 / Category 3

    Problem is i cant make two posts from category 1 to be on top all the time [ on all and on category view ]
    I’ve selected sticky on post but every time i add new post they are just not sticky and act like normal posts

    + Where do i translate ‘ All ” in magazine element ?

    #1138963

    I’ve found following code but it has a bug .. categories in magazine element are returned empty

    add_filter(‘avf_magazine_entries_query’, ‘avf_magazine_entries_query_sticky’, 10, 2);
    function avf_magazine_entries_query_sticky($query, $params) {
    $include = array();
    $sticky = get_option( ‘sticky_posts’ );

    $args = array(
    ‘taxonomy’ => $params[‘taxonomy’],
    ‘post__not_in’ => $sticky,
    );
    $posts = get_posts( $args );

    foreach($posts as $post) {
    $include[] = $post->ID;
    }

    $include = array_merge($sticky, $include);

    $query[‘post__in’] = $include;
    $query[‘orderby’] = ‘post__in’; // sort items based on the post__in value
    return $query;
    }

    #1139229

    any suggestions ?

    #1139707

    what happened with support here? it was top notch, at least some respond ?

    #1139918

    Hi,

    Sorry for the delay.

    The default query will be ignored once you use that filter, which is probably why the category sort no longer works as it should. Where did you add the magazine element?

    Best regards,
    Ismael

    #1139986

    hi again
    Ive just tested with that code and removed it so now i have default functions file again
    on homepage is magazine element [ middle news area ]

    #1140211

    Hi,

    Thank you for the update.

    We are not really sure if we can find a way around this. You can’t have the sticky posts without using the above filter, which will also alter the default query and affect the category sort. You may need to add another magazine element and apply the filter to it. You can then have the default query on the second element.

    Best regards,
    Ismael

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