Plugin Author
benz1
(@benz1)
If you start your php block with a php closing tag (to close the embedded opening tag) and end the block with a starting tag (to open the embedded closing tag) then you should be able to put your complete php in between.
Thread Starter
Pete
(@perthmetro)
Unfortunately it doesn’t work…
this is my code pasted directly into the template that works…
<?php
echo '<ul>';
global $post;
$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 ); wp_list_categories( 'title_li=&style=list&hierarchical=1&echo=1&taxonomy=' . $taxonomy . '&include=' . $term_ids ); }
echo '</ul>';
?>
This is the code in your plugin that doesn’t work…
?>
<?php
echo '<ul>';
global $post;
$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 ); wp_list_categories( 'title_li=&style=list&hierarchical=1&echo=1&taxonomy=' . $taxonomy . '&include=' . $term_ids ); }
echo '</ul>';
?>
<?php
Thread Starter
Pete
(@perthmetro)
this works…
;?>
<?php
echo '<ul>';
global $post;
$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 ); wp_list_categories( 'title_li=&style=list&hierarchical=1&echo=1&taxonomy=' . $taxonomy . '&include=' . $term_ids ); }
echo '</ul>';
?>
<?php;