Is there a way to have chunks of a page’s content expire?

If you don’t mind wrapping your content in Shortcode then you can easily have them hidden after a specific time. Granted you don’t cache the page for longer than needed. Wrap your content in [content_expires] shortcodes. Time should be based on your server’s timezone. [content_expires]NEVER Expires[/content_expires] [content_expires date=”2016-10-25 00:00:00″]PAST[/content_expires] [content_expires date=”2116-10-26 04:20:00″]FUTURE[/content_expires] Then add the … Read more

Query Posts from Custom Field Value Taxonomy Set by Admin

You cant run query based on taxonomy only. You also need to provide the taxonomy term the custom post type post associated with. Change your $args like below – $args = array( ‘post_type’=> ‘products’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘cosmetics’, // your taxonomy ‘field’ => ‘term_id’, ‘terms’ => get_term_by(‘name’, $foo, ‘cosmetics’)->term_id, // your taxonomy … Read more

Store stripe info as user_meta

Sounds like the $amount variable is empty so it’s not saving. Echo it out to see what’s happening. Make sure the $payment_user_id is an actual WordPress user_id. Wrap your update_user_meta within the if statement. // If charge is successful, store in user meta if (isset($event) && $event->type == “charge.succeeded”) { $amount = $event->data->object->amount / 100; … Read more

get_category display only 1

Added an argument for the $categories Input the ID of the parent to display all the subcategories. function ba_SearchFilter($query) { if (!$query->is_search) { return $query; } if (isset($_POST[‘cat’])){ $query->set(‘category__and’, $_POST[‘cat’]); } if (isset($_POST[‘tags’])){ $query->set(‘tag__and’, $_POST[‘tags’]); } return $query; } //hook filters to search add_filter(‘pre_get_posts’,’ba_SearchFilter’); function ba_search_with_filters(){ $out=”<form role=”search” method=”get” id=”searchform” action=””. home_url( “https://wordpress.stackexchange.com/” ).'”> <div><label … Read more

Edit errors on login and lost password screen in wordpress

you can change the message in login screen by using login_errors filter hook, just paste this code in the themes functions.php file : add_filter(‘login_errors’,’login_error_message’); function login_error_message($error){ //check if that’s the error you are looking for $pos = strpos($error, ‘incorrect’); if (is_int($pos)) { //its the right error so you can overwrite it $error = “Wrong information”; … Read more

SQL Query Search page

you can use WP_Query(); to query the results. it has an argument ‘s’ => $search_query, create an input, get the input value, store it in $search_query, then create a query, $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘s’ => $search_query ) ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); // … Read more

How to fix the loop statement

Perhaps just being sure that you set your image data within what WordPress calls “the loop” (aka inside that while where $post is set so that get_the_ID returns the info for the post currently being looped over) will get you running. Here is one idea how you might accomplish that: <?php if (have_posts()) : while(have_posts()) … Read more