我创建了一个以JSON-LD格式输出产品模式的短代码。
1 schortcode=1 product=1 product schema output 2 schortcode=2 product=2 product schema output
问题是我意识到all 文章中的产品应该创建一个JSON-LD(参见图片)。
2 schortcode=2产品=1 产品架构输出
这意味着the schema output should be outputted only by the last shortcode of this kind.
问题是
Shortcodes wordpress中的输出通常是相互独立的,它们是;“无国籍”;(输出仅取决于输入参数)。但我能强迫他们做出不同的行为吗?我曾想过在shortcode处理程序中使用全局变量并输出聚合的JSONonly after the last shortcode has been called).Is this a good solution?