Hey Guys,
I am working on a thing which seemed simple but I am struggling with something and I need a few fresh eyes. Is it because of me or what?
The thing I'm making is a few source link/text inside posts. So the authors can have enter the sources of some stuff which has been written inside the article.
No I've added this code inside functions.php (don't mind the default values, it's just for testing purposes)
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Micro Trends Sources',
'id' => 'micro-trends-sources',
'post_types' => array(
0 => 'post',
1 => 'page',
),
'context' => 'advanced',
'priority' => 'high',
'fields' => array(
array (
'id' => 'text_1',
'type' => 'text',
'name' => 'Source Title',
'size' => 50,
'clone' => 1,
'sort_clone' => 1,
),
array (
'id' => 'url_1',
'type' => 'url',
'name' => 'Source URL',
'size' => 50,
'clone' => 1,
'sort_clone' => 1,
),
),
);
return $meta_boxes;
}
Looks like this in the post area
I need to set this up with a shortcode so I've used this.
<a href="[rwmb_meta meta_key='url_1']">[rwmb_meta meta_key='text_1']</a>
And it looks like this inside the post frontend area
Now this is all looking good and works fine. Only when I click on a link it returns a 404 error. After some head smashing to the wall, I've found that there's some extra code behind the url.
It trows in a closing li and ul at the end of the url. Now I think it's because of the brackets inside the shortcode or because the shortcode is wrapped inside a href tag.
Hope this all makes some sense. I would appreciate any ideas on how to solve this. Probably something simple.
Regards,
Hein