Using radio button meta data from a custom meta box
$response_radio = $_POST[‘meta-radio’]; if ($response_radio==”radio-one”) { //do your stuff } elseif ($response_radio==”radio-two”) { //do other stuff } I think this is what you are looking for
$response_radio = $_POST[‘meta-radio’]; if ($response_radio==”radio-one”) { //do your stuff } elseif ($response_radio==”radio-two”) { //do other stuff } I think this is what you are looking for
You should check for category posts to modify content. Specify category ID (integer), name or slug (string), or an array of these in in_category check. function my_image_tag( $html, $id , $alt, $title ) { if ( in_category( ‘1’ ) ) { $html = “<div class=”my-class”>” . $html . “</div>”; } return $html; } add_filter( ‘get_image_tag’, … Read more
You can try: ‘date_query’ => array( array( ‘year’ => date( ‘Y’ ), ‘week’ => strftime( ‘%U’ ), ), ), where %U is: Week number of the given year, starting with the first Sunday as the first week or ‘date_query’ => array( array( ‘after’ => strtotime( ‘last Sunday’ ), ), ),
The determination to redirect needs to be made prior to headers being sent to the browser. Otherwise you risk PHP warnings (i.e. errors) when the page is rendered. This makes the timing of the use of wp_redirect() incorrect in the other answers. (The function is right, it’s just used incorrectly.) If you are going to … Read more
You typed “mobiles” when you said you wanted to check for post type “mobile”. So simply remove the s ;). <? if( post_type_exists( ‘mobiles’ ) ) { echo ‘The Products post type exists’;} ?> Should be: <? if( post_type_exists( ‘mobile’ ) ) { echo ‘The Mobile post type exists’;} ?> If it’s still not working, … Read more
The multipage setting is not something that happen via a query, it is handled only via global variables, inside the setup_postdata() function. The only thing you need is to increment a global variable and add your static content using the ‘the_post’ hook that is fired at the end of that function. Something like: add_action(‘the_post’, function(WP_Post … Read more
Yes. get_post_modified_time : Retrieves the time at which the post was last modified.
Whenever you add a new item to WordPress Menu ( Appearance -> Menu ) it creates a new Post of Post Type nav_menu_item and gets assigned a post meta called _menu_item_object_id with the main Post ID. For example, if I create a page called “Home” it gets assigned a Post ID of 2. Now, when … Read more
You must read custom field themeOps first, update index option3 in array and then save/update whole array. $kisiArray = get_post_meta( $post_id, ‘themeOps’ ); $kisiArray[‘option3’] = ‘peach’; update_post_meta( $post_id, ‘themeOps’, $kisiArray ); Update (sort by custom field) $args = array( ‘post_type’ => ‘post’, ‘meta_key’ => ‘themeOps_option3’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ); $query = new … Read more
wp_enqueue_media() slows down my WP site