Categories
CMS Mastering Development Wordpress

cannot echo the_post_thumbnails

I’m using the following PHP code to echo post thumbnails. <?php $args = array( ‘post_type’ => ‘post’ , ‘orderby’ => ‘date’ , ‘order’ => ‘DESC’ , ‘posts_per_page’ => 1, ‘category’ => ‘2’, ‘paged’ => get_query_var(‘paged’), ‘post_parent’ => $parent ); // The Query $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) […]

Categories
CMS Mastering Development Wordpress

How to create pagination for custom taxonomy in WordPress

my code it’s this, and i can’t create the pagination for that, its working good the pages 1, 2, 3 and etc.. but its just that the pagination links are not showing in the template. I created a template for show all the custom taxonomies with the pictures and etc.. its just that not appear’s […]

Categories
CMS Mastering Development Wordpress

How can i add video, audio, gallery post formats in my post?

**This is my index.php code ** <?php get_header(); ?> <!– Top Stories Area –> <?php echo get_template_part( ‘/template-parts/latest-post-slider’ ); ?> <!– End Stories Area –> <!– Start Post Silder Area –> <?php echo get_template_part( ‘/template-parts/banner-post-slider’ ) ?> <!– End Post Silder Area –> <!– Start main body Area –> <div class="main-body section-gap"> <div class="container box_1170"> […]

Categories
CMS Mastering Development Wordpress

Blog post per page setting conflicting with custom WP_Query?

I am creating a theme, and have run into a problem with how a custom WP_Query seems to interact with the Blog pages show at most settings found under Settings -> Reading in the WordPress backend. I have a paged query, where – for layout reasons, I want to display 6 posts per page. My […]

Categories
CMS Mastering Development Wordpress

How to sort posts based on likes using Likebtn-plugin

On Likebtn-plugin homepage ([https://likebtn.com/en/wordpress-like-button-plugin#sort_posts_by_likes][1]) they give this code to input in a template file, e.g. index.php, archives.php, page.php, such that the posts are sorted based on the number of likes. I have input the code in the archives.php and the content is sorted correctly when I click on a category. But I also want to […]

Categories
CMS Mastering Development Wordpress

show most viewed post

I have blog post counts which happen when a user views a blog post via ajax and the rest api. In the database I have a meta key and value like so: table: wp_postmeta post_id: blog post ID meta_key: blog_post_count meta_value: number ie: 1, 2, 3 etc. This basically stores the blog post ID and […]

Categories
CMS Mastering Development Wordpress

Can’t reset tax query using ajax sorting plugin?

I have created an ajax sorting feature that filters a custom post type "Music" and its all separated by Genres and Tags.. the sorting works fine until.. I deselect all options. I’ve tried to add "all" as the default and added in the JS that if the genre is "all" to include all the posts. […]

Categories
Mastering Development

GraphQL filtering/sorting DatoCMS GatsbyJS

I have the following GraphQL query: export const query = graphql` query NewsQuery($slug: String!) { datoCmsNews(slug: { eq: $slug }) { id title description slug meta { publishedAt } cover { fluid(maxHeight: 530) { …GatsbyDatoCmsSizes } } } allDatoCmsNews(sort: { fields: [meta___publishedAt], order: DESC }, limit: 4) { edges { node { id title slug […]

Categories
CMS Mastering Development Wordpress

WPML returning posts that are not published

I’m working on a website that uses WPL for translation. The website has 2 languages, french (main) and english. The problem I’m facing is that in a list of posts in the, english version, it’s showing french posts. In these cases the posts have an english version but not published yet. This is the query […]

Categories
CMS Mastering Development Wordpress

Sorting not working with get_posts

I have been looking at this for hours but can’t get it to work. $newsItems2 = get_posts([ “post_type” => “post”, “post_status” => “publish”, “posts_per_page” => 3, “orderby” => “date”, “order” => “DESC”, ‘meta_query’ => [ [ ‘key’ => ‘news__type’, ‘value’ => ‘general’, ‘compare’ => ‘=’ ] ] ]); The query works but it refuses to […]