Categories
CMS Mastering Development Wordpress

Ordering posts by publish date not working?

My site has a "Portfolio" page, which pulls in posts in category 3. Here is my code which selects the posts: <?php $args = array(‘cat’ => 3, ‘post_type’ => ‘post’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="portfolio-item"> <?php the_post_thumbnail() ?> <a href="<?php […]

Categories
CMS Mastering Development Wordpress

Ordering posts by publish date not working?

My site has a "Portfolio" page, which pulls in posts in category 3. Here is my code which selects the posts: <?php $args = array(‘cat’ => 3, ‘post_type’ => ‘post’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="portfolio-item"> <?php the_post_thumbnail() ?> <a href="<?php […]

Categories
CMS Mastering Development Wordpress

set transient for wp_query and refresh it after 25 minutes

As I have a auto feed website and I decide to use transient for improving website loading So I have a wp_query and I want to use transient for this query and expire it after 25 minutes <ul> <?php $portfolio = new WP_Query(array( ‘post_status’ =>’publish’, ‘post_type’ =>’post’, ‘fields’ => ‘ids’, ‘cat’ =>”.$link1.”, ‘posts_per_page’ =>’9′ )); […]

Categories
CMS Mastering Development Wordpress

WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination

This my code for sub category archive page: <?php // the query $the_query = new WP_Query(array( ‘category__and’ => array( 2 ), ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘posts_per_page’ => 12, ‘paged’ => get_query_var( ‘paged’ ), )); ?> <?php if ($the_query->have_posts()) : ?> <?php while ($the_query->have_posts()) : $the_query->the_post(); ?> //Contents Here// <?php endwhile; ?><?php wp_reset_postdata(); ?><?php […]

Categories
CMS Mastering Development Wordpress

How to pull latest posts from a specific category

I’m trying to pull the latest posts from the category "local-news" but I’m only seeing one of the two posts that exist for this category. I’m not sure if it’s my if statement and/or while loop that’s causing the issue. This is my first time developing a WP theme and using PHP so I’m a […]

Categories
CMS Mastering Development Wordpress

how to make my custom gallery work in wordpress

So am creating a custom theme in WordPress and looking to achieve this I was able to output my category but not too sure how to output the remaining information. As you can see from the image below for each category there is a recent blog post on the left and then other blog post […]

Categories
CMS Mastering Development Wordpress

how to make my custom gallery work in wordpress

So am creating a custom theme in WordPress and looking to achieve this I was able to output my category but not too sure how to output the remaining information. As you can see from the image below for each category there is a recent blog post on the left and then other blog post […]

Categories
CMS Mastering Development Wordpress

how to make my custom gallery work in wordpress

So am creating a custom theme in WordPress and looking to achieve this I was able to output my category but not too sure how to output the remaining information. As you can see from the image below for each category there is a recent blog post on the left and then other blog post […]

Categories
CMS Mastering Development Wordpress

WP_Query: getting posts where custom field exists

I’m trying to get posts that all have a custom field named webinar, but I just get all posts. Here is what I have: $args = array( ‘showposts’ => -1, ‘post_type’ => ‘post’, ‘meta_query’ => array( ‘key’ => ‘webinar’, ‘compare’ => ‘EXIST’, ), ); $loop = new WP_Query($args); if($loop->have_posts()) { while ( $loop->have_posts() ) { […]

Categories
CMS Mastering Development Wordpress

i am using api add post in wordpress

i will use below link to add post in my WordPress enter link description here this is the link for JSON data this my code :- $reddit_data = wp_remote_get( ‘https://myfundbox.com/webhook?listByProjectId=6’ ); $reddit_data_decode = json_decode( $reddit_data[‘body’] ); foreach ( $reddit_data_decode->prodList as $item ) { $post_title = $item->DBUrl; // post title $reddit_author = $item->CollectedAmount; // author $up_votes […]