-
AuthorPosts
-
March 15, 2018 at 6:55 pm #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!
March 18, 2018 at 5:45 am #928604Hey 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,
IsmaelMarch 19, 2018 at 8:24 pm #929304Thanks, but that code seems to break my home page — nothing loads below the nav.
March 20, 2018 at 7:31 am #929557Hey!
Did you copy the code from your email? Please copy the filter directly from this forum.
Best regards,
IsmaelMarch 20, 2018 at 7:47 pm #930088No, 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!
March 21, 2018 at 9:28 pm #930864Hi,
It can be yes. The things suggested from us are basic.
Could you try contact them again please?Best regards,
BasilisMarch 30, 2018 at 2:42 am #935090OK, 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”
April 2, 2018 at 4:42 am #935886Hi,
Can you give us ftp access? so we can inspect further.
Best regards,
NikkoApril 2, 2018 at 7:17 am #935925Well, 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?
April 2, 2018 at 8:22 am #935955Hi,
Sure, my temporary public ip is in private content.
Best regards,
NikkoApril 3, 2018 at 1:35 am #936248OK, he said he whitelisted your IP — sftp in private content (note, it’s sftp, not ftp) — thanks!!
April 4, 2018 at 1:48 pm #937143Hi,
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,
NikkoApril 4, 2018 at 8:29 pm #937362OK, that one’s cleared now.
April 7, 2018 at 9:34 am #938580Hi,
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.
Best regards,
IsmaelApril 12, 2018 at 6:28 pm #941074Here’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?
April 13, 2018 at 10:20 pm #941679Hi,
We are a remote taem of workers and many times with different IPS’
Best regards,
BasilisApril 13, 2018 at 10:33 pm #941682OK, I give up — I think we have a sufficient workaround for this using the offset option in the Magazine elements anyway — thanks anyway.
-
AuthorPosts
- The topic ‘sticky posts for magazine element’ is closed to new replies.