Viewing 27 posts - 1 through 27 (of 27 total)
  • Author
    Posts
  • #1079577

    Hi there,
    On the homepage of my Korfball Club (https://kvtelstar.nl) I use an Avia blog grid by the category ‘algemeen nieuwsbericht’. Sometimes a post has to be sticky, but it doesn’t stay on the 1ste position. I have researched the topics but haven’t found a solution. Can you help me?

    #1080419

    Hey Maureen,

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
      ( do be sure that we have enough time to debug ).
    5. Click ” Submit “.
    6. You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.

    When your issue is fixed, you can always remove the plugin!
    If you prefer to not use the plugin, you can manually create a admin user and post the login credentials in the “private data” field.

    Best regards,
    Nikko

    #1080929

    Hereby your new login information.

    #1081399

    Hi Maureen van Goethem,

    Can you try adding this css code in functions.php of your child theme?

    add_filter('avia_feature_image_slider_query', 'avia_feature_image_slider_query_mod', 10, 1);
    function avia_feature_image_slider_query_mod($query) {
    	$query['posts_per_page'] = 1;
    	$query['post__in'] = get_option( 'sticky_posts' );
    	$query['ignore_sticky_posts'] = 1;
    	return $query;
    }

    I tried adding it but I’m prevented from doing so and get this error:

    Communicatie met de site niet mogelijk om te controleren op fouten, de PHP aanpassing is teruggedraaid. De PHP-bestandswijziging moet op een andere manier worden gewijzigd, bijvoorbeeld door SFTP te gebruiken.

    Best regards,
    Nikko

    #1081406

    CSS code added to functions.php but still no sticky post on position no. 1.

    In related-posts.php I see this:

    $my_query = get_posts(
    array(
    ‘tag__in’ => $tag_ids,
    ‘post_type’ => get_post_type($this_id),
    ‘showposts’=>$postcount, ‘ignore_sticky_posts’=>1,
    ‘orderby’=>’rand’,
    ‘post__not_in’ => array($this_id))
    );

    Has that something to do with this?

    #1082082

    Hi Maureen van Goethem,

    No, it has nothing to do with it and only affects related posts.
    Try the solution in this thread: https://kriesi.at/support/topic/sticky-posts-in-b-og-grid/#post-692059
    just replace:

    $query['posts_per_page'] = 6;

    with

    $query['posts_per_page'] = 8;

    Best regards,
    Nikko

    #1082641

    The code works; I see sticky post on 1st position, but… now I see 6 posts instead of 8 on the homepage. So I made 3 columns instead of 4, which is my favorite.
    And I see 6 on https://www.kvtelstar.nl/nieuws/ instead of 15 and pagination is gone.

    #1082907

    Hi Maureen van Goethem,

    If you replace the 6 on this code to 8:

    $query['posts_per_page'] = 6;

    It should be changed to 8.
    Do you still need sticky posts on https://www.kvtelstar.nl/nieuws/ ? or just on the frontpage?

    Best regards,
    Nikko

    #1083040

    I already have changed that yesterday

    And I need a sticky post only on the homepage.
    Now I see 7 on the homepage and 7 on https://www.kvtelstar.nl/nieuws/. Here it should be all news posts and pagination.

    #1083374

    Hi Maureen van Goethem,

    Try to use this code instead:

    add_filter('avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2);
    function avia_post_slide_query_mod($query, $params) {
      
      if( is_front_page() ) {
        $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);
    
        // convert values of the $include from string to int
        function sti($n)
        {
          settype($n, 'int');
          return $n ;
        }
    
        $include = array_map("sti", $include);
    
        $query['post__in'] = $include;
        $query['posts_per_page'] = 8;
        $query['orderby'] = 'post__in'; // sort items based on the post__in value
      }
      return $query;
    }

    Best regards,
    Nikko

    #1083511

    An error

    Parse error: syntax error, unexpected ‘=’, expecting ‘)’ in /var/www/vhosts/kvtelstar.nl/httpdocs/wp-content/themes/enfold-child/functions.php on line 25

    #1083851

    Hi Maureen van Goethem,

    Can you try doing this instead, please add:

    if( is_front_page() ) {

    below this code:

    function avia_post_slide_query_mod($query, $params) {

    then add this code:

    }

    just above:

    return $query;

    Best regards,
    Nikko

    #1084224

    Like this:
    // add_filter(‘avia_post_slide_query’, ‘avia_post_slide_query_mod’, 10, 2);
    function avia_post_slide_query_mod($query, $params) {
    if( is_front_page() ) {

    if( is_front_page() ) {
    $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);

    // convert values of the $include from string to int
    function sti($n)
    {
    settype($n, ‘int’);
    return $n ;
    }

    $include = array_map(“sti”, $include);

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

    #1084227

    Parse error: syntax error, unexpected ‘=’, expecting ‘)’ in /var/www/vhosts/kvtelstar.nl/httpdocs/wp-content/themes/enfold-child/functions.php on line 26

    I transfered the old functions.php file and now it show still 7 on the homepage.

    #1084526

    Hi Maureen van Goethem,

    I’m not really sure why that’s causing errors, since I have tried this on my end.
    Can you give us ftp access? we’ll try to modify it then post the changes made if it works properly.

    Best regards,
    Nikko

    #1090919

    I’m sorry. Due to some very personal matters I wasn’t able to response earlier. I hereby send you my ftp access (from filezilla).

    #1091387

    Hi Maureen van Goethem,

    No worries, I tried the details above using Filezilla however I could not get access.
    I tried both ftp and sftp.

    Best regards,
    Nikko

    #1091389

    This is the only information I have, greetings, Maureen

    #1091446

    Hi Maureen,

    I’m still getting the same error, I put a screenshot in private content.
    Can you provide us something where we can access files, like a cpanel? just change the password once we have fixed the issue.

    Best regards,
    Nikko

    #1091450

    can you try this password

    #1091500

    Hi Maureen,

    Thanks it works, I have added this code in your functions.php:

    add_filter('avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2);
    function avia_post_slide_query_mod($query, $params) {
    
      if( is_front_page() ) {
        $include = array();
        $sticky = get_option( 'sticky_posts' );
    
        if(empty($terms[0]) || is_null($terms[0]) || $terms[0] === "null") {
          $term_args = array( 
            'taxonomy' => $params['taxonomy'],
            'hide_empty' => true
          );
    
          $allTax = AviaHelper::get_terms( $term_args );
              
          $terms = array();
          foreach( $allTax as $tax ) {
            $terms[] = $tax->term_id;
          }
        }
    
        $args = array(
          'post_type' =>	$params['post_type'],
          'offset' =>	$params['offset'],
          'posts_per_page' =>	8,
          'post__not_in' => $sticky,
          'tax_query' => array(
            array(
              'taxonomy' =>	$params['taxonomy'],
              'field' => 'id',
              'terms' => $terms,
              'operator' =>	'IN'
            )
          )
        );
        $posts = get_posts( $args );
    
        foreach($posts as $post) {
          $include[] = $post->ID;
        }
    
        $include = array_merge($sticky, $include);
    
        // convert values of the $include from string to int
        function sti($n)
        {
          settype($n, 'int');
          return $n ;
        }
    
        $include = array_map("sti", $include);
    
        $query['post__in'] = $include;
        $query['posts_per_page'] = 8;
        $query['orderby'] = 'post__in'; // sort items based on the post__in value
      }
      return $query;
    }
    

    Let us know if you need further assistance.

    Best regards,
    Nikko

    #1091552

    I see that you did all that, but…. I see 7 posts on the homepage and not 8!

    #1091594

    Hi Maureen,

    I see 8 on my end.
    I have posted a screenshot in private content on how it looks on my end.
    Tested it with icognito browser also to make sure it’s not logged in.
    Maybe you’ll need to flush out the cache.

    Best regards,
    Nikko

    #1091605

    Okay. Well I think I must delete my cache of my browser. I’ll look at it tomorrow! Thank you so far!!!

    #1091806

    Hi Maureen,

    Thanks for the update, we’ll leave the thread open in case you should need any further help on the topic.

    Best regards,
    Rikard

    #1093763

    All is well!
    Thank you!!!

    #1093807

    Hi Maureen van Goethem,

    Glad that we could help :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 27 posts - 1 through 27 (of 27 total)
  • The topic ‘Sticky posts by category in blog grid’ is closed to new replies.