How to get total posts count for each date?

Instead of the second loop, do the following: Count the posts per date Display them as you will // Count the posts per date $count = []; foreach ( $posts as $post ) { $date = get_the_date( ‘Y-n-j’, $post ); $count[ $date ] = ! isset( $count[ $date ] ) ? 1 : $count[ $date … Read more

fetch from an external api call and display results in page

Guide to displaying data from an external API in WordPress using a shortcode: 1. Create a Shortcode in functions.php Create a shortcode in your functions.php file that outputs a container for the results and includes a JavaScript file: function fetch_external_api_data() { wp_enqueue_script(‘custom-api-fetch-script’); return ‘<div id=”apiResults”></div>’; } add_shortcode(‘external_api_data’, ‘fetch_external_api_data’); 2. Enqueue and Write JavaScript Create api-fetch.js … Read more

SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop

SOLUTION: I looked through Divi’s functions.php & saw that the term for the project tags is ‘project_tag’, so when I amended my $query args it now works! Thank you very much to everyone who responded 🙂 $query_args = array( ‘post_type’ => ‘project’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘posts_per_page’ => ‘3’, ‘project_tag’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)