Querying posts from wordpress with 2 or more conditionals

You can pass array with multiple queries to meta_query. Something like: ‘meta_query’ => array( array( ‘key’ => ‘eg-enddate’, ‘value’ => date(“d/m/Y”), ‘compare’ => ‘>’, ‘type’ => ‘numeric’ ), ‘relation’ => ‘AND’, array( ‘key’ => ‘eg-startdate’, ‘value’ => date(“d/m/Y”), ‘compare’ => ‘<‘, ‘type’ => ‘numeric’ ) ) For more please go through documentation: https://codex.wordpress.org/Class_Reference/WP_Meta_Query Note: Code … Read more

Use Custiomizer to setup meta theme color tag

Depending on whether you store your customizer settings as mods or options (which you define with the type parameter when adding a setting) you can simply use get_option or get_theme_mod in your header.php like this: echo ‘<meta name=”theme-color” content=”‘ . get_theme_mod(‘my_browser_bar_color’,’#000000′) . ‘”>’; This line tells to look for the mod and if it isn’t … Read more

Add disclaimer before certain posts and pages

Is there a better way to accomplish this using the affiliate tags on my posts? Definitely I would go for an easier option, not relying on plugins like Jetpack. Why don’t you try the has_tag function? Something like this: function tt_filter_the_content( $content ) { if (has_tag(‘affiliate’)) $custom_content=”YOUR MESSAGE”; $custom_content .= $content; return $custom_content; } add_filter( … Read more

How to include non-users in wp-admin redirect?

You can do something like this to redirect everyone that enter to the wp-login.php Notice that its redirect only when the request is GET so you could still can enter if you post to there. its in the case that you use this wp-login.php with your custom login page. function login_page_redirect() { $redirect_to = “http://google.com”; … Read more