New custom option to article [Recipe]

Posted in: Newspaper
Post count: 4

Hello,
Can you tell me where can I add a new option for the article? For the moment there is one for Review and Simple article. I want an option called recipe so that on AMP on Google data structured I get errors.
<article id="post-30124" class="post-30124 post type-post status-publish format-standard has-post-thumbnail hentry category-dinner category-ketogenic-recipes" itemscope itemtype="https://schema.org/Article">

in

<article id="post-30124" class="post-30124 post type-post status-publish format-standard has-post-thumbnail hentry category-dinner category-ketogenic-recipes" itemscope itemtype="https://schema.org/Recipe">

I’ve seen that this code exists in theme in Newspaper/includes/wp_booster/td_module_single_base.php. I tried to modifiy it but it didn’t work

function get_item_scope() {
//show the review meta only on single posts that are reviews, the rest have to be article (in article lists)
if ($this->is_review && is_single()) {
return 'itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Review"';
} else {
return 'itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Article"';
}
}

I would like to add this so I can select from the post

function get_item_scope() {
//show the review meta only on single posts that are recipe
if ($this->is_recipe && is_single()) {
return 'itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Recipe"';
} else {
return 'itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Article"';
}
}

Post count: 23312

Hello AlexGuzi,

Unfortunately, the theme does not have any such an option that allows you to add new option for articles, sorry! Your bottom implementation is not wrong but you should further treat the is_recipe in the theme core because the theme does not recognize it. It’s custom, sorry! As a hint, you should make some checkers in with get_item_posst_meta() in td_module_single_base.php. If you are not aware of the steps which are needed to take in this case, please consider hiring a freelancer/developer to help you because we cannot provide custom work at the moment, sorry!

Thanks for your understanding!

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.