Home>Support>post injections into page builder. help me please

post injections into page builder. help me please

I am using this code below to insert into every single post. I’m using a plugin called Head, Footer and Post Injections to insert that code.

However, I am currently redoing every post with Site Origin Page Builder, and that code no longer works.

Is there a way to alter this code to work with page builder?

<H3>Genres</H3>
<?php
$taxonomy = 'category';

// Get the term IDs assigned to post.
$post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );

// Separator between links.
$separator = ', ';

if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {

    $term_ids = implode( ',' , $post_terms );

    $terms = wp_list_categories( array(
        'title_li' => '',
        'style'    => 'none',
        'echo'     => false,
        'taxonomy' => $taxonomy,
        'include'  => $term_ids,
        'child_of' => 2
    ) );

    $terms = rtrim( trim( str_replace( '
',  $separator, $terms ) ), $separator );

    // Display post categories.
    echo  $terms;
} ?></BR>
<H3>Availabilities</H3>
<?php
$taxonomy = 'category';

// Get the term IDs assigned to post.
$post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );

// Separator between links.
$separator = ', ';

if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {

    $term_ids = implode( ',' , $post_terms );

    $terms = wp_list_categories( array(
        'title_li' => '',
        'style'    => 'none',
        'echo'     => false,
        'taxonomy' => $taxonomy,
        'include'  => $term_ids,
        'child_of' => 42,
        'depth'    => 3,
    ) );

    $terms = rtrim( trim( str_replace( '
',  $separator, $terms ) ), $separator );

    // Display post categories.
    echo  $terms;

} ?>

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 4 months ago Alex S
    Hi, I Work Here

    Hi Timothy,

    Please navigate to WP AdminSettingsPage Builder and open the Content tab. Tick Content Cache. Does the code work now?

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More