adrianistrate
Forum Replies Created
-
Forum: Plugins
In reply to: [Solid Post Likes] Shortcode not displayed in WP_Query resultsHi @gin
A triplicate heart icon, funny, this is something I haven’t thought about :))
Actually on step 7 you need to comment the entire IF statement and instead of that if, above of it, return the output.
Here is how it looks and works on my end
$oacs_spl_show_likes_setting = carbon_get_theme_option('oacs_spl_show_likes'); return $output; /** General output */ //if ($oacs_spl_show_likes_setting) { // // only show on single posts. // if(is_singular()) { // return $output; // } //} else { //// and not on archive pages. // return; //}
Forum: Plugins
In reply to: [Solid Post Likes] Shortcode not displayed in WP_Query resultsHi @gin
I solved my problem (and pretty sure will work for yours too) by making a change in one of the php files from the plugin.
My complete step by step solution:
- Download the plugin zip file
- Unzip de plugin
- Go to solid-post-likes\views and find SolidPostLikesPublic.php file
- Open the file with a text editor
- Go to oacs_spl_display_like_button function
- at the end of the function you will find an if statement that specify to show the button only on single posts.
- Comment that IF statement and instead of that simply return $output;
- Save the file
- Zip back the entire content
- Upload the new zip archive into your wordpress site
As fas as I’m concerned, my problem was solved and from this point of view I will mark this thread as rezolved.
Forum: Plugins
In reply to: [Solid Post Likes] Shortcode not displayed in WP_Query resultsHello there!
Sure, below is the function that I use, with a template to display the rezults
function filter_projects() { $catSlug = $_POST['category']; $ajaxposts = new WP_Query([ 'post_type' => 'post', 'posts_per_page' => -1, 'category_name' => $catSlug, 'orderby' => 'menu_order', 'order' => 'desc', ]); $article_list = ''; if($ajaxposts->have_posts()) { while($ajaxposts->have_posts()) : $ajaxposts->the_post(); $article_list = get_template_part('templates/project-list-item'); endwhile; } else { //$response = 'No posts found…'; //echo $newsletter_top; exit; } echo $article_list; exit; } add_action('wp_ajax_filter_projects', 'filter_projects'); add_action('wp_ajax_nopriv_filter_projects', 'filter_projects');
And project-list-item looks like this
<?php $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium_large'); $image_url = $image_arr[0]; $categories_arr = get_the_category(get_the_ID()); $categorie = $categories_arr[0]->cat_name; ?> <li> <div class="blog_home_item_container"> <span class="blog_home_post_category"><?= $categorie; ?></span> <img src="<?= $image_url; ?>" alt="post_image" onclick="location.href='<?= get_permalink() ?>';"/> <div class="blog_home_item_text"> <label class="blog_home_post_date"> <i aria-hidden="true" class="fas fa-calendar"></i> <?= get_the_date(); ?> </label> <strong class="blog_home_post_title" onclick="location.href='<?= get_permalink() ?>';"><?= the_title(); ?></strong> <!--<span class="blog_home_post_exerpt"><?= get_the_excerpt(); ?></span>--> <div class="blog_home_post_info"> <div class="blog_home_post_stats"> <span class="blog_home_post_views"><i aria-hidden="true" class="far fa-eye"></i> <?= do_shortcode('[post-views]'); ?></span> <span class="blog_home_post_comments"><i class="far fa-comment"></i><?= get_comments_number(get_the_ID()); ?></span> </div> <div> <span><?= do_shortcode('[oacsspl]'); ?></span> </div> </div> </div> </div> </li>
I would like to mention that I use the same template in a very similar script that I wrote with Code Snippets and the shortcode works there. The problem seems to be when I filter posts with the function located in functions.php file.