I’m not clear on how your code works as-is, as I mentioned in my comment. It looks like you’re adding an action to call a function inside the function that you want to call with that action. If nothing outside the function invokes it, it never runs.
add_action( 'template_redirect', 'check_breadcrumb_condition' );
function check_breadcrumb_condition(){
global $post;
$crumb = get_post_meta($post->ID, 'custom_breadcrumb', true);
if ($crumb) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_before_loop', 'customfield_breadcrumbs' );
}
}
function customfield_breadcrumbs() {
global $post;
echo '<div class="breadcrumb">';
echo get_post_meta($post->ID, 'custom_breadcrumb', true);
echo '</div>';
}
Related Posts:
- Is there any action filter/hook for validating a custom field before publishing the post?
- Displaying Custom Fields on Post with Genesis Child Theme
- get_post_meta not working inside loop
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Registration and Profile custom field
- Custom Fields Code not echoing whats in the value field
- Changing form action based on selected value
- trying to add extra field using hooks
- author.php not showing content if Author has no Posts
- How can I hide my section title if there is no data in custom fields?
- Query posts by Custom Meta (checkbox) & Genesis Grid Loop
- WP_Query – Order results by meta value
- Custom query with orderby meta_value of custom field
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- How to enable revisions for post meta data?
- Can I query custom meta data through WP_Query
- Including custom fields in search?
- Change behavior of “Insert into Post” based on attachment metadata
- Sort posts by custom field numeric value using dropdown
- How to position a custom field before the editor
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- Is there a way to do multiple ordering on a multiple meta_query?
- searching in custom meta field
- How to add upload field in a custom taxonomy?
- Display thumbnail from custom field
- Bulk move (or copy) from a custom field to the post content?
- Store JSON in a custom field
- Getting Custom Field data from a page hierarchy
- Custom contact form 7 select with custom values [closed]
- limit amount of photos uploaded per cpt post
- Problem with adding exta field in metabox in custom post type
- Setting orderby to a custom field using pre_get_posts
- Add WYSIWYG to Image Description field
- Calling custom profile fields?
- How to Display Custom Meta Box only on Specific Page IDs
- Get custom field label
- Show ACF fields only on certain page in the backend
- Is it better practice to use ‘This Name Format’ or ‘this-name-format’ for custom fields?
- Storing a DateTime Value in a Sortable Custom Field?
- How to show a post if was published less than two hours ago?
- Custom field as Slug
- How to save the date/time of last update of an extra user profile field?
- How to populate custom field dropdown box based on prior selection?
- Define a post’s title and slug from Custom Fields
- How can you include custom post meta in search without calling each key?
- Custom wysiwyg editor doesn’t execute shortcodes?
- How to hide a div based on contents of custom field
- Hook after meta created
- What is the largest value you can store in a custom field (as meta data for a post)?
- Where does this field get its value?
- ORDER BY custom field value out of where clause
- Get all the posts where meta field with multiple choice has several values checked
- Warn user that data may be lost for custom pages
- List custom field values in alphabetical order without repetition
- Can’t query by meta_key
- Display MP3 as media using an URL from a custom field
- WordPress custom fields feature is missing in my installation
- Print Posts if Custom Field Value Date equal or greater than Today Date
- Update post meta custom field using block editor
- If I update WordPress my custom data will be deleted from the wp_users table?
- Get emails from users by custom field SQL
- Save all custom field data into one “master” custom field
- Convert all dates stored in custom field
- Plugin or shortcode for ISBN number?
- HM CMB: Role Select
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Custom Query Fields – Altering Meta Value
- Replacing custom field with shortcode
- WPAlchemy issue when using 2 select menus with the same values inside a repeating group
- Adding re-type email and check it if the email match
- show a specific metabox dependent on the page template
- excluding posts by an ACF field in pagination
- Search & column order by meta value in admin
- Exclude URL’s from sanitize_html_classes
- Is the use of many custom field not good for server?
- How to add a post’s view count into the WordPress API response
- How can I ‘check’ the “custom fields” box from the Screen Options?
- Can you generate a featured image from two images from custom fields?
- How to get all wp_posts in wordpress fetched from database
- Search fails when using the radio buttons
- automatically add custom fields to post title
- Custom Fields Permalink Plugin not observing hyphens
- will wp_insert_post write a new custom field to the database?
- How to repeate custom field group with bulk image field
- Extra text’n’image field in a page
- Get first URL from custom field, download and set as featured image on post publish
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Syling Custom Fields echo’s from from functions.php
- How to add an option to admin to add image that could be used as header?
- Custom Field add markup to line breaks
- Use Metabox to enter Post Title
- Include custom fields into the content of a regular page
- Bypassing a Form Options
- How to query posts that have certain post meta keys, and sort by meta key and/or value
- How to implement jquery-ui autocomplete into custom fields?
- i want to send email on custom post field (job_status == 2) but it is not working
- Add custom fields to specific menus
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?