How to list articles by year based on url?

Avoid using query_posts() Please don’t use query_posts(‘posts_per_page=10’); in your date.php template file as it will override the main query instance and thus affect the main loop. This can truly ruin the day! If you need to modify e.g. the posts_per_page for the main date query, use the pre_get_posts action to modify the query variables, before … Read more

Wpautop in wp_editor not working

Normally, the wpautop filter is only applied to the_content and the_excerpt. In this case you want to apply it to metadata. So you’ll have to add the filter. If you look at get_post_meta, you’ll see that it is just a wrapper for get_metadata. So it doesn’t matter which one you use if you retrieve the … Read more

Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?

The name you see is the text domain of the theme. __(‘some text’, ‘text-domain’) is a translation function, which makes it possible to translate the some text into different languages. There are also other translation functions that can be used in different situations. You can learn more about translations on the codex, I18n P.s. if … Read more

post_exists returning 0 if title contain special characters

Looks like WP is using HTML entity encoding on the special characters, you need to parse the title using the html_entity_decode() function like so. $title = html_entity_decode(get_the_title($result->post_id)); if ( 0 === post_exists( $title ) ) { $title=”Document Id: “.$result->post_id .’ (Deleted)’; } I am not sure if the post exists function decodes the characters but … Read more

i cant see the max_num_pages of a custom wp query

Your variables are not in functions scope. My example of function: function customPagination($paged = ”, $max_page=””) { global $wp_query; $big = 999999999; if( ! $paged ) $paged = get_query_var(‘paged’); if( ! $max_page ) $max_page = $wp_query->max_num_pages; echo paginate_links( array( ‘total’ => $max_page, ‘prev_next’ => false, ‘prev_text’ => false, ‘next_text’ => false, ‘total’ => $wp_query->max_num_pages, ‘mid_size’ … Read more

Template for landing pages

in your theme folder. create a new php file. For example call it: landingpage.php in the php file you could have something as basic as: <?php /* Template Name: Landing Page */ get_header(); while ( have_posts() ) : the_post(); the_content(); endwhile; get_footer(); ?> Elementor will be called / inserted where it says the_content(); Included out … Read more