Forum Replies Created

Viewing 15 replies - 16 through 30 (of 52 total)
  • Thread Starter mhairilongmuir

    (@mhairilongmuir)

    I got this working thanks, didn’t realise I needed to to specify that is showed posts aswell

    ie, I needed:

    show_posts="yes" post_type="dinosaur"

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Hi,

    Thank you for your reply.

    The code is in the normal post editor.

    Yes, it’s in a loop.

    You can see that the ‘view’ button inside the accordions isn’t going anywhere: https://www.etextbooks.ac.uk/dissertations/chapter-1-what-is-research-and-why-do-it/

    Here is the code that I’ve used:

    <h3>Chapter 1 resources</h3>
    Click on the section to expand it
    
    [insert_php]
    $str='
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="images" compare="and"][field title][/loop]
    ';
    if(checkshortcodeoutput($str)){
    echo do_shortcode('
    [toggle title_open="Images" title_closed="Images" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
    [raw]
    [block class="table-of-interactions"]
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="images" compare="and"]
    [fourcol_three]
    <h4 style="margin-bottom: 10px;">[field title]</h4>
    <p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
    <a class="button small" href="[field url]">view</a>
    [/fourcol_three][fourcol_one_last]
    <a style="float: right;" title="[image-title]" href="[field url]">[field image="thumbnail" size="thumbnail"]</a>
    
    [/fourcol_one_last]
    
    <hr />
    
    [/loop]
    [/block]
    [/raw]
    [/toggle]
    ');
    }
    [/insert_php]
    
    [insert_php]
    $str='
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="audio" compare="and"][field title][/loop]
    ';
    if(checkshortcodeoutput($str)){
    echo do_shortcode('
    [toggle title_open="Audio" title_closed="Audio" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
    [raw]
    [block class="table-of-interactions"]
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="audio" compare="and"]
    [fourcol_three]
    <h4 style="margin-bottom: 10px;">[field title]</h4>
    <p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
    <a class="button small" href="[field url]">view</a>
    [/fourcol_three][fourcol_one_last]
    <a style="float: right;" title="[image-title]" href="[field url]">[field image="thumbnail" size="thumbnail"]</a>
    
    [/fourcol_one_last]
    
    <hr />
    
    [/loop]
    [/block]
    [/raw]
    [/toggle]
    ');
    }
    [/insert_php]
    
    [insert_php]
    $str='
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="videos" compare="and"][field title][/loop]
    ';
    if(checkshortcodeoutput($str)){
    echo do_shortcode('
    [toggle title_open="Video" title_closed="Video" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
    [raw]
    [block class="table-of-interactions"]
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="videos" compare="and"]
    [fourcol_three]
    <h4 style="margin-bottom: 10px;">[field title]</h4>
    <p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
    <a class="button small" href="[field url]">view</a>
    [/fourcol_three][fourcol_one_last]
    <a style="float: right;" title="[image-title]" href="[field url]">[field image="thumbnail" size="thumbnail"]</a>
    [/fourcol_one_last]
    
    <hr />
    
    [/loop]
    [/block]
    [/raw]
    [/toggle]
    ');
    }
    [/insert_php]
    
    [insert_php]
    $str='
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="useful-web-links" compare="and"][field title][/loop]
    ';
    if(checkshortcodeoutput($str)){
    echo do_shortcode('
    [toggle title_open="Useful web links" title_closed="Useful web links" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
    [raw]
    [block class="table-of-interactions"]
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="useful-web-links" compare="and"]
    [fourcol_three]
    <h4 style="margin-bottom: 10px;">[field title]</h4>
    <p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
    <a class="button small" href="[field url]">view</a>
    [/fourcol_three][fourcol_one_last]
    <a style="float: right;" title="[image-title]" href="[field url]">[field image="thumbnail" size="thumbnail"]</a>
    [/fourcol_one_last]
    
    <hr />
    
    [/loop]
    [/block]
    [/raw]
    [/toggle]
    ');
    }
    [/insert_php]
    
    [insert_php]
    $str='
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="activities-tools" compare="and"][field title][/loop]
    ';
    if(checkshortcodeoutput($str)){
    echo do_shortcode('
    [toggle title_open="Activities & tools" title_closed="Activities & tools" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
    [raw]
    [block class="table-of-interactions"]
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="activities-tools" compare="and"]
    [fourcol_three]
    <h4 style="margin-bottom: 10px;">[field title]</h4>
    <p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
    <a class="button small" href="[field url]">view</a>
    [/fourcol_three][fourcol_one_last]
    <a style="float: right;" title="[image-title]" href="[field url]">[field image="thumbnail" size="thumbnail"]</a>
    [/fourcol_one_last]
    
    <hr />
    
    [/loop]
    [/block]
    [/raw]
    [/toggle]
    ');
    }
    [/insert_php]
    
    <hr />
    
    <h3>Chapter 1 discussion forum</h3>

    And here is the code in the PHP snippet (it makes the accordion only show if there is content inside it – I had someone else write this code)

    add_filter( 'the_content', 'will_bontrager_insert_php', 8 );
    //add_filter('the_content', 'do_shortcode', 11);
    function checkshortcodeoutput($str){
      if(!empty($str)){
    	$output=do_shortcode($str);
    	if(!empty(trim($output)))
    	  return true;
    	else
    	  return false;
      }
    }
    remove_filter( 'the_content', 'wpautop' );
    add_filter( 'the_content', 'wpautop' , 12);

    Thank you for any help, I’m up against a deadline and hoping I can get this sorted without having to redo it with another plugin on every page.

    Cheers ??

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Interesting – it would be good to know if there were any fixes, cheers

    Hi, this field has just stopped working for me – on a live site. I really need to get it back up running as soon as possible. Can anyone suggest anything please? My WP and plugin are up to date, cheers

    This is the website: https://www.etextbooks.ac.uk/dissertations/chapter-1-what-is-research-and-why-do-it/

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Hi,

    On looking at it properly, it doesn’t seem to be working. Maybe I should explain better and you can tell me if the code above will fit what I’m trying to do…

    The two custom taxonomies that I have are called:

    • interaction-media-types
    • chapter

    And the taxonomy terms are:

    • interaction-media-types: activities-tools, audio, images, useful-web-links, videos
    • chapter: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13

    Here is the [edited] code that you have provided me with, that I’m using:

    function custom_has_chapter( $term ) {
       return has_term( $term, 'chapter' );
    }
    function custom_has_media( $term ) {
       return has_term( $term, 'interaction-media-types' );
    }

    My site is set up as a companion site for an ebook, and each page is associated with one of the 13 chapters. There is content at the bottom of the page for each chapter, which is split into a media type, showing in accordions. What I’m trying to do, is only make that accordion show if there is content associated with that chapter, and media type, ie. chapter: 1, media type: video has content in it, but it’s not currently showing anything (aside from a [/if] tag?) when using the following code:

    [if custom_has_chapter="1"][if custom_has_media="video"]
    [toggle title_open="Video" title_closed="Video" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
    [raw]
    [block class="table-of-interactions"]
    [loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="videos" compare="and"]
    [fourcol_three]
    <h4 style="margin-bottom: 10px;">[field title]</h4>
    <p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
    <a class="button small" href="[field url]">view</a>
    [/fourcol_three][fourcol_one_last]
    <a style="float: right;" title="[image-title]" href="[thumbnail]">[field image="thumbnail" size="thumbnail"]</a>
    [/fourcol_one_last]
    
    <hr />
    
    [/loop]
    [/block]
    [/raw]
    [/toggle]
    [/if][/if]

    Do you know where I’m going wrong? Many thanks for your help.

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Thank you very much for that, much appreciated.

    So, I’m using that, and it seems to be working (I think). The only thing is that the 2nd closing if tag is also showing? Eg. ‘[/if]’ is showing on my page, do you know why this is happening?

    Cheers

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Can I amend that, I have tbody tags, but no thead tags, cheers!

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    so, back to the original request – making the accordions only display if there is content in the loop…

    The code you gave me (‘exists’) doesn’t work at the moment, when I add it to what I have there, because the accordion is outside the loop

    Do you know of any way that I can re-hash my code so that I can put the accordion inside the loop – I’ve had no success so far…

    [toggle title_open=”Video” title_closed=”Video” hide=”yes” border=”yes” style=”default” excerpt_length=”0″ read_more_text=”Read More” read_less_text=”Read Less” include_excerpt_html=”no”]
    [raw]
    [block class=”table-of-interactions”]
    [loop type=”interaction” taxonomy=”chapter” term=”1″ taxonomy_2=”interaction-media-types” term_2=”images” compare=”and”]
    [fourcol_three]
    <h4 style=”margin-bottom: 10px;”>[field title]</h4>
    <p style=”margin-bottom: 10px;”>[field short_description format=”true” length=”365″]</p>
    view
    [/fourcol_three][fourcol_one_last]
    [field image=”thumbnail” size=”thumbnail”]

    [/fourcol_one_last]

    <hr />

    [/loop]
    [/block]
    [/raw]
    [/toggle]

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    I found out what it was…

    I hadn’t re-applied the settings that allowed me to use the html ‘block’ and ‘raw’ tags – switched back on and the block coding is gone.

    Cheers

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Oops, I can’t attached a screenshot!

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Hi there,

    In your plugin update, have you changed how we use the code to display posts? My posts are displaying differently than before (see screenshot), I have no idea why, I presume the way the code is being interpreted is different…

    Cheers,
    Mhairi

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    How do I actually do the import, I can’t find it in the navigation… cheers

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Hi, thank you for your email. What do you mean when you say that I will have to take care? Anything in specific?

    Cheers

    I’d also like to know this, thanks

    Thread Starter mhairilongmuir

    (@mhairilongmuir)

    Thank you very much for the instructions. I tlooks like it’s generating random numbers, is it possible to change these to be incremental? (After this is done, I’m good to go!!!!)

    Many thanks

Viewing 15 replies - 16 through 30 (of 52 total)