Meta Box Data added to header redirect
Meta Box Data added to header redirect
Meta Box Data added to header redirect
You can use is_single() in a conditional statement. <?php if( is_single() ){ ?> <ul> <li class=”Source”><a>source:</a></li> <ul class=”Source-Link”> <li><a href=”https://wordpress.stackexchange.com/questions/121060/<?php echo get_post_meta($post->ID,”source-link’, true); ?>” target=”_blank”><?php echo get_post_meta($post->ID, ‘source’, true); ?></a></li> </ul> </li> </ul> <?php }?> Be aware though that this will appear on any single page, meaning a single post page and a single page. … Read more
Ok, I got it work. Since the checkbox for the custom fields stores entires as a comma seperated value, I needed to explode the delimiter and then perfom another loop to parse the information. Then I created two separate arguments to split the data and call it back within the echo. Here’s my final output … Read more
I think the problem is not with shortcode but with your code – you can’t nest blocks 😉 This should work just fine, I guess: <?php echo do_shortcode(“[standout-css3-button href=””. get_post_meta($post->ID, “church-website-url’, true) .”‘]Church website[/standout-css3-button]”); ?>
Use: get_post_meta(): if ( get_post_meta( $post->ID, ‘MyField’, $single=true ) ) { echo get_post_meta( $post->ID, ‘MyField’, $single=true ); }
You have to add: ‘meta_key’ => ‘key_name’ to the arguments array in order to use the key with the orderby parameter. Additionally you have to have the orderby parameter like this: ‘orderby’ => ‘meta_value’ But if you have the data you want to sort by saved into an array, like your code suggests, you have … Read more
You can hook into before_delete_post and redirect before completing the deletion. add_action(‘before_delete_post’, function($post_id) { // Get custom field $field = get_post_meta( $post_id, ‘key’, ‘true’); // Redirect if field is empty if (!$field) { wp_redirect(admin_url(‘edit.php’)); exit(); } }, 1);
you can use esc_attr function save_taxonomy_custom_meta_bandcamp_embed_music( $term_id ) { if ( isset( $_POST[‘term_meta’] ) ) { $t_id = $term_id; $term_meta = get_option( “taxonomy_$t_id” ); $cat_keys = array_keys( $_POST[‘term_meta’] ); foreach ( $cat_keys as $key ) { if ( isset ( $_POST[‘term_meta’][$key] ) ) { $term_meta[$key] = esc_attr( $_POST[‘term_meta’][$key] ); // encoded text with HTML entities … Read more
change the line if ( ‘page’ == $_POST[‘post_type’] ) { To if ( ‘page’ == get_post_type($post_id) ) {
Firstly, init hook doesn’t supply $post_id as an argument. Secondly, you have miss-matched variable name – $postid & $post_id Here’s the revised code – function get_fields_company_profile() { if( isset($_GET[‘post’]) && ” != $_GET[‘post’] && isset($_GET[‘action’]) && ‘edit’ == $_GET[‘action’] && ( !isset($_GET[‘post_type’]) || ‘post’ == $_GET[‘post_type’] ) ){ global $wpdb; $postid = (int) $_GET[‘post’]; $row … Read more