How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
You have mistake here: ….. $news = $temp_news.get_post(); remove .get_post() from there.
You have mistake here: ….. $news = $temp_news.get_post(); remove .get_post() from there.
The problem was that I didn’t have a single.php file. When I added this and then added the single-medewerkers.php file it works perfectly. Thanks anyway!
Okay, I think to start you need to change line 470 of the file includes/admin/class-learndash-admin-binary-selector.php from: ‘post_status’ => array(‘publish’), to ‘post_status’ => array(‘any’), If this doesn’t work on its own, there may be other places you need to change this as well – do a global file search on ‘post_status’ and look for places where … Read more
Ohh it was quick! I figured it out, so simple. I only had to change the scheme to the following: …/%category%/%postname%/ Great! Thanks anyway 😉
You can match this with regEx and easily choose the amount of paragraphs to return. // in context function triangle_x_excerpt( $text, $raw_excerpt ) { $content = apply_filters( ‘the_content’, get_the_content() ); $text = ( preg_match( sprintf( ‘~(<p>.+?</p>){%d}~i’, 1 ), $content, $matches ) ) ? $matches[ 0 ] : $content; return preg_replace( “/<img[^>]+\>/i”, “”, $text ); } … Read more
1 – I’d create a custom field for marking a post as ‘favourite’. 2- Then you would add a meta_query bit to the code in which you are querying the DB. There are several ways to do (1) and several ways to do part (2). How familiar are you with WordPress development? If your theme … Read more
Query posts from newest category
Delete 100+ posts or media files from wordpress faster than default?
Yes, the_post_navigation() works outside of the loop on single post views. Following the function calls, the_post_navigation() uses get_the_post_navigation() which uses get_previous_post_link() and get_next_post_link() which use get_adjacent_post_link() which finally uses get_post() which defaults to the global $post object. Here’s an excerpt of get_adjacent_post_link(): function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms=””, $previous = true, $taxonomy = … Read more
if ( get_the_ID() !== 45 ) { // Will run for all posts other than ID 45 } if ( get_the_title() !== ‘My Post’ ) { // Will run for all posts that don’t have the title “My Post” } if ( get_post_field( ‘post_name’ ) !== ‘my-post’ ) { // Will run for all posts … Read more