Transient not working for external data

You write “if ( false === $external_figures )” but forgot write “else” with echo $external_figures Example: if ( false !== $external_figures ) { echo $external_figures; }else{ ob_start(); $production_url=”my-url”; …

How to filter get previous post function by meta value DESC and post date DESC?

You should just do a new full query for all posts (not just featured ones), and set the orderby to meta_value and just check when doing the loop, if that post meta value is yes, and output the featured template, otherwise output standard one. https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters UPDATE: Maybe something like this: $args = array( ‘posts_per_page’ => … Read more

Url outside the loop

Just copy and paste below code. you can replace ‘get_the_ID()’ with page/post id otherwise it will return image for current page/post. cheers!!! $size = “full”; $urlarr = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $size); $imgurl = $urlarr[0]; this will return complete url of the image.

Slug is changing when I use WP_Query in a metabox of a post

I think that I already found the problem. From wordpress get_posts documentation the have an example of get_post <ul> <?php global $post; $args = array( ‘posts_per_page’ => 5, ‘offset’=> 1, ‘category’ => 1 ); $myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post ); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/273344/<?php the_permalink(); ?>”><?php … Read more

How to manually define the primary loop

WordPress is not the solution to world hunger, global warming, and not even a good tool to create a one page apps in. If that is what you need, there are probably much better tools that will give you a much better ROI. In theory you can use wordpress as an API, creating an “headless” … Read more

Excerpt isn’t working or am I missing something?

No it’s not. The length limit is for excerpt, which should be called manually. To get the excerpt in your loop, you should use: <p><?php the_excerpt(); ?></p> Instead of: <p><?php the_content(); ?></p> If you thought of this because of the option in the reading section of settings: Then you have to notice, this is for … Read more

Query posts and display all dates in repeater field in chronological order

I think I succeeded in making the array and sorting it by date (see var_dump) array(575) { [320]=> array(10) { [“Speeldatum”]=> string(19) “2015-01-30 12:00:00” [“Productienaam”]=> string(28) “THE DOG DAYS ARE OVER (2014)” [“Makernaam”]=> string(11) “Jan Martens” [“Locatienaam2”]=> string(10) “toneelhuis” [“Stadnaam”]=> string(9) “ANTWERPEN” [“Landnaam”]=> string(2) “BE” [“Festivalnaam”]=> string(18) “antwerpse kleppers” [“Onderdeelvandezegripeveningnaam”]=> string(38) “antwerpse kleppers / bourla … Read more

Split Content and Gallery

Open to anybody who can simplify this but here’s what I came up with that worked for me. First thing’s first – get the gallery, using get_post_gallery(), as soon as the loop starts: <?php if( have_posts() ) : ?> <?php while( have_posts() ) : the_post(); $gallery = get_post_gallery(); $content = strip_shortcode_gallery( get_the_content() ); ?> <div … Read more

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