Can you provide the code that sets up the meta box?
I am having the same issues after the update. Code that worked previously seems unable to find the rwmb_meta function as function_exists('rwmb_meta')
returns false.
Can you post your code NoxPointe and where you have placed it? rwmb_meta seems to work fine on a template.
Hi Manny,
What do you mean by “Can you provide the code that sets up the meta box?”
The code in my OP is just one example of a number of separate templates that use the same code (but with different categories/tags) to display the custom fields (book_code, book_author, book_price) for each book.
The code for the functions.php file is as follows
rwmb_meta( $field_id, $args = array(), $post_id = null );
This is in /inc/homepage_functions.php
which is included in functions.php
function get_program_highlights() {
$highlights = false;
if (function_exists(‘rwmb_meta’)) {
$highlights = array();
for ($i=1; $i <= 3; $i++) {
$highlights[$i] = rwmb_meta(‘_vetmed_program_highlight_’ . $i);
}
}
return $highlights;
}
I’m trying to replicate your situation as close as possible, which means getting the meta box code so I can create that, add data then creating my own template based on your code to see what is going wrong.
Using my own code I’m not getting any issues so I want to use your exact code so I can figure out whats wrong and fix it.
Hi Manny,
The code I posted in my first post is one example of where I use your plugin. I’ll provide an entire template code below. If you’d like to look at the site to see how it works, it’s kentrotman.co.uk
<?php
/**
* The template for displaying a book category.
*
Template Name:New-Osprey
*/
get_header(); ?>
<div class="main-content index">
<h2><?php the_title(); ?></h2>
<hr/>
<div class="book-row-container">
<?php
$args = array('category_name' => 'osprey', 'tag_slug__and' => array('osprey'), 'orderby' => 'book_code', 'order' => 'ASC', 'posts_per_page'=> -1);
$postslist = get_posts($args);
foreach ($postslist as $post) : setup_postdata($post); ?>
<div class="book-row clearfix ">
<div class="book-thumbnail">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( $size, $attr ); ?></a>
</div>
<p class="code"><?php echo rwmb_meta( 'book_code' ); ?></p>
<p class="code"><em><strong><?php echo rwmb_meta( 'mycpt' ); ?></strong></em></p>
<a href="<?php the_permalink() ?>"><h4><?php the_title(); ?></h4></a>
<p class="author"><?php echo rwmb_meta( 'book_author' ); ?></p>
<p class="price">£<?php echo rwmb_meta( 'book_price' ); ?></p>
<form action="formaction" method="POST">
<input type="HIDDEN" name="userid" value="9629947">
<input type="HIDDEN" name="product" value="<?php echo rwmb_meta( 'book_code' ); ?> <?php the_title();?>">
<input type="HIDDEN" name="price" value="<?php echo rwmb_meta( 'book_price' ); ?>">
<input type="HIDDEN" name="qty" value="1">
<input type="HIDDEN" name="return" value="www.kentrotman.com">
<input type="HIDDEN" name="units" value="1">
<input class="cta" type="SUBMIT" value="Buy Now" name="SUBMIT">
</form>
</div>
<?php endforeach; ?>
<!-- ? php endwhile; ? -->
</div>
<br/>
<h2>Previously Listed</h2>
<hr/>
<div class="book-row-container">
<?php
$args = array('category_name' => 'osprey', 'tag_slug__and' => array('prevlist'), 'orderby' => 'book_code', 'order' => 'ASC', 'posts_per_page'=> -1);
$postslist = get_posts($args);
foreach ($postslist as $post) : setup_postdata($post); ?>
<div class="book-row clearfix ">
<div class="book-thumbnail">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( $size, $attr ); ?></a>
</div>
<p class="code"><?php echo rwmb_meta( 'book_code' ); ?></p>
<p class="code"><em><strong><?php echo rwmb_meta( 'mycpt' ); ?></strong></em></p>
<a href="<?php the_permalink() ?>"><h4><?php the_title(); ?></h4></a>
<p class="author"><?php echo rwmb_meta( 'book_author' ); ?></p>
<p class="price">£<?php echo rwmb_meta( 'book_price' ); ?></p>
<form action="formaction" method="POST">
<input type="HIDDEN" name="userid" value="9629947">
<input type="HIDDEN" name="product" value="<?php echo rwmb_meta( 'book_code' ); ?> <?php the_title();?>">
<input type="HIDDEN" name="price" value="<?php echo rwmb_meta( 'book_price' ); ?>">
<input type="HIDDEN" name="qty" value="1">
<input type="HIDDEN" name="return" value="www.kentrotman.com">
<input type="HIDDEN" name="units" value="1">
<input class="cta" type="SUBMIT" value="Buy Now" name="SUBMIT">
</form>
</div>
<?php endforeach; ?>
<!-- ? php endwhile; ? -->
</div>
<?php get_footer(); ?>
Hope this is what you meant. Otherwise, aside from the small line in the functions.php file, I have done nothing else to make it work.
Thanks
Grrr although I had replied to you about 5 minutes ago, it appears to have not posted.
So basically, here’s my template code. But I can’t think of anything else you would need, other than this template (which is one of many) and the one liner in the functions.php file, I haven’t needed to do anything else to make it work pre-update. The website is kentrotman.co.uk.
You can see from the code below, the custom fields are book_code, book_price, book_author and mycpt.
<?php
/**
* The template for displaying a book category.
*
Template Name:New-Osprey
*/
get_header(); ?>
<div class="main-content index">
<h2><?php the_title(); ?></h2>
<hr/>
<div class="book-row-container">
<?php
$args = array('category_name' => 'osprey', 'tag_slug__and' => array('osprey'), 'orderby' => 'book_code', 'order' => 'ASC', 'posts_per_page'=> -1);
$postslist = get_posts($args);
foreach ($postslist as $post) : setup_postdata($post); ?>
<div class="book-row clearfix ">
<div class="book-thumbnail">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( $size, $attr ); ?></a>
</div>
<p class="code"><?php echo rwmb_meta( 'book_code' ); ?></p>
<p class="code"><em><strong><?php echo rwmb_meta( 'mycpt' ); ?></strong></em></p>
<a href="<?php the_permalink() ?>"><h4><?php the_title(); ?></h4></a>
<p class="author"><?php echo rwmb_meta( 'book_author' ); ?></p>
<p class="price">£<?php echo rwmb_meta( 'book_price' ); ?></p>
<form action="formaction" method="POST">
<input type="HIDDEN" name="userid" value="9629947">
<input type="HIDDEN" name="product" value="<?php echo rwmb_meta( 'book_code' ); ?> <?php the_title();?>">
<input type="HIDDEN" name="price" value="<?php echo rwmb_meta( 'book_price' ); ?>">
<input type="HIDDEN" name="qty" value="1">
<input type="HIDDEN" name="return" value="www.kentrotman.com">
<input type="HIDDEN" name="units" value="1">
<input class="cta" type="SUBMIT" value="Buy Now" name="SUBMIT">
</form>
</div>
<?php endforeach; ?>
<!-- ? php endwhile; ? -->
</div>
<br/>
<h2>Previously Listed</h2>
<hr/>
<div class="book-row-container">
<?php
$args = array('category_name' => 'osprey', 'tag_slug__and' => array('prevlist'), 'orderby' => 'book_code', 'order' => 'ASC', 'posts_per_page'=> -1);
$postslist = get_posts($args);
foreach ($postslist as $post) : setup_postdata($post); ?>
<div class="book-row clearfix ">
<div class="book-thumbnail">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( $size, $attr ); ?></a>
</div>
<p class="code"><?php echo rwmb_meta( 'book_code' ); ?></p>
<p class="code"><em><strong><?php echo rwmb_meta( 'mycpt' ); ?></strong></em></p>
<a href="<?php the_permalink() ?>"><h4><?php the_title(); ?></h4></a>
<p class="author"><?php echo rwmb_meta( 'book_author' ); ?></p>
<p class="price">£<?php echo rwmb_meta( 'book_price' ); ?></p>
<form action="formaction" method="POST">
<input type="HIDDEN" name="userid" value="9629947">
<input type="HIDDEN" name="product" value="<?php echo rwmb_meta( 'book_code' ); ?> <?php the_title();?>">
<input type="HIDDEN" name="price" value="<?php echo rwmb_meta( 'book_price' ); ?>">
<input type="HIDDEN" name="qty" value="1">
<input type="HIDDEN" name="return" value="www.kentrotman.com">
<input type="HIDDEN" name="units" value="1">
<input class="cta" type="SUBMIT" value="Buy Now" name="SUBMIT">
</form>
</div>
<?php endforeach; ?>
<!-- ? php endwhile; ? -->
</div>
<?php get_footer(); ?>
Okay, but what kind of code are you using for the meta boxes? I need that part so I can create some data for the template.
Oh I see, you want data input. Ok usually in book_code I’d have something like B002, book_price is 20.00 (e.g.) and book_author is something like FLEURMOND (M)
mycpt isn’t an issue, that’s just a “notes” bit.
How are you creating your meta boxes? Using admin_init or the rwmb_meta_boxes filter?
Can you please update the Meta Box to 4.8.1? And post the code you used to register meta boxes?
Hi Manny,
As found in both code examples I have previously posted, this is how I get the meta box data to appear on the website.
<p class="price">£<?php echo rwmb_meta( 'book_price' ); ?></p>
If this isn’t what you mean, you’re going to have to explain to me what you want.
Thanks
I have the same issue, too. I’ve updated to 4.8.1 and all my custom field data area disappeared from the site.
I create the metabox with rwmb_meta_boxes filter.
How resolve it?
Thanks!
Hi, I have written a guide to fix the problem on metabox.io blog:
https://metabox.io/steps-fix-problems-meta-box-4-8-0/
Please follow these steps and let me know if it works.
Thanks