This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

post injections into page builder. help me please

8 years ago · Last reply by Alex S 8 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

1
  1. Alex S Staff 8 years, 8 months ago

    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.

Have a different question or issue?

Start New Thread