Dynamic archive of posts by date

Please note that I have now resolved this issue. For whomever is interested, please find my code below (I’ve included everything to a shortcode to facilitate adding it anywhere I want): function archiveday() { $x=1; do { $result = date(‘l jS F Y’,strtotime(“-$x days”)); $year= date(‘Y’,strtotime(“-$x days”)); $month= date(‘n’,strtotime(“-$x days”)); $day= date(‘j’,strtotime(“-$x days”)); $my_query2 = … Read more

PHP – Multiple variables in insert post array

$post_id = wp_insert_post( array( ‘comment_status’ => ‘open’, ‘ping_status’ => ‘closed’, ‘post_author’ => $current_user->ID, ‘post_name’ => $slug, ‘post_title’ => $pollq_question, ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘post_content’ => $_POST[‘poll-description’] . ‘[poll id=’ . $latest_pollid . ‘]’ ) );

seo meta description issue in google search

An easier way to check what is happening is to check the source code of your pages where the meta description is added through Yoast <meta name=”description” <meta property=”og:description” content=” Check what the above values say and if there is any conflict. If the text in the above meta fields are not as entered through … Read more

Custom URL rewrite with add_rewrite_rule

Updating the rewrite-rules manually as follows worked for me: function gallery_rewriterules( $wp_rewrite ) { $new_rules = array( “hochzeitsfotografen/([^/]+)/([^/]+)/?([0-9] {1,})/?” => “index.php?fotograf=”.$wp_rewrite->preg_index(1).”& gallery=”.$wp_rewrite->preg_index(2).”&img=”.$wp_rewrite->preg_index(3)); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_filter(‘generate_rewrite_rules’,’gallery_rewriterules’);

How to reuse php templates as shortcodes?

You can write a wrap function for short code like that. function simplest_shortcode_ever() { ob_start(); ?> Your PHP Logic here <?php return ob_get_clean(); } add_shortcode( ‘simple_shortcode’, ‘simplest_shortcode_ever’ ); And then use it[simple_shortcode]