Shortcode in a shortcode
-
I am trying to get this working, but with real trouble – and have tried everything I can:
[wpv-view name=”MyViewName” taccnt =”[MyShortcode]”]
[MyShortcode] is working and standalone it returns ‘xyz’
The view shortcode is also working and if I change it to:
[wpv-view name=”MyViewName” taccnt =”xyz”]
then I get the expected output.
However when I have the full view as follows (shortcode in a shortcode):
[wpv-view name=”MyViewName” taccnt =”[MyShortcode]”]
then this is the exact output I get based on this example:
xyz “]
Additional Info. The [MyShortCode] returns the current taxonomy using this PHP and the Shortcode Exec plugin.
$term = get_term_by ( ‘slug’ ,get_query_var ( ‘term’ ),get_query_var ( ‘taxonomy’ ) );
echo $term->name;I have also tried one shortcode like this:
$term = get_term_by ( ‘slug’ ,get_query_var ( ‘term’ ),get_query_var ( ‘taxonomy’ ) );
echo do_shortcode(‘[wpv-view name=”Taxonomy Content” taccnt =”echo $term->name;”]’);But it doesn’t work… echo $term->name; returns the right term for the taxonomy (Deposit Match), but it doesn’t work in my shortcode (no posts found).
Whereas this:
$term = get_term_by ( ‘slug’ ,get_query_var ( ‘term’ ),get_query_var ( ‘taxonomy’ ) );
echo do_shortcode(‘[wpv-view name=”Taxonomy Content” taccnt =”Deposit Match”]’);works perfectly… and returns the post required.
I have tried everything I can think of to get this working somehow. Please help!?
- The topic ‘Shortcode in a shortcode’ is closed to new replies.