Get post only from ‘standard’ post format

Do, <?php if( false == get_post_format() ){ ?> <a href=”https://wordpress.stackexchange.com/questions/103119/<?php the_permalink(); ?>” rel=”bookmark”><?php the_title(); ?></a> <?php } ?> The standard post format isn’t actually a post format, so if you conditionally check whether a post contains a post format (other than the default standard), it will return false, because it’s set to… standard.

When a user creates a post (pending), send a confirmation link that allows them to publish

You need a function that hook into post status transitions and send and email containing a link with some verification variables and a function that takes that variables, check them and if all ok update posts status. Following code I think is self-explanatory, and comments give additional help: add_action(‘new_to_pending’, ‘send_approve_link’); add_action(‘draft_to_pending’, ‘send_approve_link’); add_action(‘auto-draft_to_pending’, ‘send_approve_link’); add_action(‘init’, … Read more

Change the default number of posts to show on mobile version

Firstly, you need to detect mobile devices, probably the easiest and a built in possibility is wp_is_mobile. It is simpler then other solutions that are available, but works reasonably well. It can be altered, if necessary, take a look at this question for a first insight into that. Secondly, if that concerns your main query, … Read more

WP_Query to work with custom view

Use a custom view in the front-end: You can try to modify the SELECT queries in the front-end with the following (alpha) plugin: <?php /** * Plugin Name: wpdb – a custom SELECT view for the wp_posts table on the front-end * Version: alpha */ ! is_admin() && add_filter( ‘query’, function( $query ) { global … Read more

Query posts distinct authors

With what you are asking, it is really difficult to come up with some performant easy way that is also reliable. As @birgire already stated, his solution is not reliable, but from tests, it seem to be the fastest clocking in at 2 db queries in about 0.015s average. From a quick discussion between @birgire … Read more

Updating a post without escaping ampersands?

That is correct, the updating in the Admin section does not change the & to &amp; while the wp_update_post() function (which can be found under /wp-includes/post.php on line 3772) does but only when the user does not have the capability unfiltered_html, let me explain how I found this out, and what I recommend. I did … Read more

Categories box not showing on post edit pages

For all who have the problem just with WordPress Blocks/Gutenberg, here is the solution I was looking for a long time. When you create a new taxonomy, make sure you’ve set show_in_rest to true. Otherwise it will not appear in Block editor. https://developer.wordpress.org/reference/functions/register_taxonomy/ Whether to include the taxonomy in the REST API. Set this to … Read more

Getting a div content of a post in wordpress?

Using DOMDocument and DOMXPath you could try this. <?php while (have_posts()) : the_post(); ob_start(); // run the_content() through the Output Buffer the_content(); $html = ob_get_clean(); // Store the formatted HTML $content = new DomDocument(); // Create a new DOMDocument Object to work with our HTML $content->loadHTML( $html ); // Load the $html into the new … Read more

how to get permalink using sql

I am not sure why you are using a custom query and not get_posts() or WP_Query as you should. Anyway, you need to get the post ID … $query =”SELECT wp_posts.post_title AS title , wp_posts.post_content AS content, wp_posts.post_date AS blogdate , wp_posts.ID AS ID And then just pass this ID to get_permalink(): get_permalink( $post->ID ); … Read more

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