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

Can I Paginate Post after every 25 tag?

If you looking to split one posts into a few pages, you could use a plugin such as custom next page. Or with the tag without a plugin. If you mean you want 25 posts in page with posts list (archive page) , you could set Pagination, You could see example in cods. Or through … 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

Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop

That error means you’re attempting to address a string or null as if it were an array. Perhaps it’s returning fewer than 5 matches, in which case $array[0][4] would be unset. Here’s your problem: function thing($content) { preg_match_all(“/(<h[^>]*>.*?<\/h2>\n*<p>.*?<\/p>)/”, $content, $array); $i = 1; $limit = count($array[0]); $array = $array[0][4]; // you’ve overwritten $array with what … Read more

Retrieve posts inside foundation tabs and tab-content split by 3 per row

I managed to ‘solve’ the problem with the code below. It’s not a pretty solution but it does the job. Any adjustments to the code to make it more pretty are welcome. <?php /* Template Name: Page information */ get_header(); ?> <div class=”row”> <div class=”main-wrap” role=”main”> <?php do_action( ‘foundationpress_before_content’ ); ?> <div class=”row”> <div class=”column”><a … Read more