Hi
I have created a custom post type called alt-category
and additionally created a custom template which I have assigned to a new post.
I want to insert the content of that post into my category description.
This is where I am at so far:
1. Installed Insert Page
Plugin so I can insert a piece of shortcode
2. I created a custom field called alt_page_id
3. I created a hook and function in my functions.php - at the moment all I have is a post ID no shortcode - I just want to see if I can get that Post ID
add_action( 'woocommerce_after_main_content', 'add_alt_description', 10 );
function add_alt_description(){
$current_cat_id = get_queried_object_id();//This gets the correct Category ID for the page I want
echo $current_cat_id;
$value = rwmb_the_value( 'alt_page_id','' , $current_cat_id ) ;//This is supposed to display the post ID
echo $value;
}
4. The format I need to display the shortcode using the $value
as a variable is
[insert post='$value' display='content']
I have 2 issues
1. The $current_cat_id
does give me the correct category but the $value
variable is outputting nothing
2. in item 4, as I have a custom post type
I'm not sure what to put after [insert
should it be my custom post type slug? e.g. alt-category
.
Can you help?