Custom Field: Display only if a specific key is selected outside the loop
Custom Field: Display only if a specific key is selected outside the loop
Custom Field: Display only if a specific key is selected outside the loop
You can try to add this filter <?php /** * Plugin Name: Shortcodes support for the Custom Fields Widget plugin * */ add_filter( ‘custom_field_value’, ‘do_shortcode’ ); as a plugin. This should hopefully make your shortcodes work. Here you can read more about the WordPress function do_shortcode().
So here’s what I ended up doing: I hide the publish button, replace it with my own publish button (one that does not submit the form) and when you click that button the validation script is executed. When there are no errors, a click event is registered on the original publish button. That way, no … Read more
You can do it easily with jQuery by using .eq() to add a specific class to each i element. Example: Add a class to your i element from PHP. <?php wp_list_pages(‘link_before=<i class=”retina_icon”></i>&link_after=<br >’); ?> Then add another class to it with jQuery. jQuery(‘.retina-icon:eq(0)’).addClass(“retina-icon-1”); jQuery(‘retina-icon:eq(1)’).addClass(“retina-icon-2”);
So after a few hours of research I implemented a solution using custom fields. To design my fields and apply them only to certain pages, I used the Advanced Custom Fields plugin. with this I created a set of custom fields for each page type that I needed to which I needed to attach specific … Read more
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
Use: get_post_meta(): if ( get_post_meta( $post->ID, ‘MyField’, $single=true ) ) { echo get_post_meta( $post->ID, ‘MyField’, $single=true ); }
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