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

Shortcode result appears above page content

You should use output control functions if you want to do it this way: function cotizador_shortcode($atts) { … your code here … ob_start(); ?> <!– THE CODE BELOW SHOULD APPEAR IN THE PAGE CONTENT AS A TABLE –> … HTML here … <?php $output = ob_get_contents(); ob_end_clean(); return $output; } add_shortcode(‘cotizador’, ‘cotizador_shortcode’);

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