Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #927576

    I found some code you provided for enabling sticky posts in the blog element, but I can’t seem to find something similar for the magazine element — can you give us a snippet to make sticky posts work in the magazine element? I’m using the option with the first entry displayed bigger (in case that matters).

    The site’s at https://www.waternewsnetwork.com/, but I have a Coming Soon plugin blocking it, so I’ll provide credentials for you, just in case you need them…

    Thanks!

    #928604

    Hey sky19er,

    Thank you for using Enfold.

    Please use this filter in the functions.php file.

    // sticky posts
    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);
    
    	// 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'] = 6;
    	$query['orderby'] = 'post__in'; // sort items based on the post__in value
    	return $query;
    }

    Best regards,
    Ismael

    #929304

    Thanks, but that code seems to break my home page — nothing loads below the nav.

    #929557

    Hey!

    Did you copy the code from your email? Please copy the filter directly from this forum.

    Best regards,
    Ismael

    #930088

    No, I did copy it from the forum, but I noticed a plugin I often use — phpenkoder, and email encoder — caused the same issue when I installed it yesterday, so maybe it’s not the fault of the code? I tried disabling all the plugins, though, and it was still causing that issue. Do you think it could have something to do with the server configuration? They have some tight security on this site and I’ve had to have them do several things to enable permissions to add plugins, overwrite theme files, etc. Any ideas for me? Thanks!

    #930864

    Hi,

    It can be yes. The things suggested from us are basic.
    Could you try contact them again please?

    Best regards,
    Basilis

    #935090

    OK, he said he couldn’t find any server configuration issues or anything, but he thinks it might have something to do with the function sti($n) being
    declared twice. He dug up the error, below, and said, if you comment out that function in the child theme, the page renders. But commenting out that function doesn’t solve my problem, because then I see multiple posts in my Magazine elements (even though I have them set to only show 1 post each), and the sticky post functionality still doesn’t seem to be working.

    Any clues for me, based on this new info? Please let me know if you have any other questions!

    2018/03/28 12:38:26 [error] 27373#27373: *370846 FastCGI sent in stderr: “PHP message: PHP Fatal error: Cannot redeclare sti() (previously declared in /home/waternewsnetwork/wordpress/wp-content/themes/enfold-child/functions.php:22) in /home/waternewsnetwork/wordpress/wp-content/themes/enfold-child/functions.php on line 22” while reading upstream, client: 216.103.1.5, server: http://www.waternewsnetwork.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “www.waternewsnetwork.com”

    #935886

    Hi,

    Can you give us ftp access? so we can inspect further.

    Best regards,
    Nikko

    #935925

    Well, for this particular job, the client has to whitelist whatever IP I’m working from in order for me to FTP, so can you give me an IP that I can get cleared for you?

    #935955

    Hi,

    Sure, my temporary public ip is in private content.

    Best regards,
    Nikko

    #936248

    OK, he said he whitelisted your IP — sftp in private content (note, it’s sftp, not ftp) — thanks!!

    #937143

    Hi,

    I apologize for the delay, can you remove the previous ip and use this one, since I had a intermittent internet connection yesterday.

    Best regards,
    Nikko

    #937362

    OK, that one’s cleared now.

    #938580

    Hi,

    We’re very sorry for the late response. I’m not sure when will Nikko be able to check the thread. Please allow the countries listed in our “about” page temporarily.

    // https://kriesi.at/about

    Best regards,
    Ismael

    #941074

    Here’s what our IT guy said about that: “I need specific ips for them because it doesn’t do it by country (and I don’t know what ips are for what countries).” — anything you can do for me?

    #941679

    Hi,

    We are a remote taem of workers and many times with different IPS’

    Best regards,
    Basilis

    #941682

    OK, I give up — I think we have a sufficient workaround for this using the offset option in the Magazine elements anyway — thanks anyway.

Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘sticky posts for magazine element’ is closed to new replies.