Shortcode atts for WP Query args

It’s typically best practice to not extract your shortcode atts. function dis_short_events($atts, $content = null){ ob_start(); $numero = shortcode_atts(array( ‘number’ => ‘-1’, ), $atts); $args =array( ‘post_type’=>’eventi’, ‘posts_per_page’ => $numero[‘number’] );

Need help in setting up a transient using API Key and if possible updating it in the ACF field

As discussed in the comments, here’s an attempt to fetch both pda and upa in a single request: /** * Make a Moz v1 URL Metrics request for a given domain * * @see https://moz.com/help/links-api/v1-archive/v1-url-metrics * @see https://moz.com/help/links-api/v1-archive/response-fields * @param $domain */ function moz_v1_links_api_request($domain) { if ( !$domain ) { return NULL; } $cache_key = … Read more

Pagination for custom posts loop

Post loop with pagination in the shortcode [title-snippet type=”post” limit=”5″]: function wpc_shortcode_title( $atts ) { extract( shortcode_atts( array( ‘limit’ => 5, ‘type’ => ‘post’), $atts ) ); $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; query_posts( array ( ‘posts_per_page’ => $limit, ‘post_type’ => $type, ‘order’ => ‘ASC’, ‘orderby’ =>’menu_order’, ‘paged’ => $paged ) ); $list=” “; … Read more