rel="animal-highlander" with swaptitle
-
Hey Guys,
i tried to combine rel=”animal-highlander” with swaptitle, but when i have an opened content and click on a second content the swaptitle doesn’t change to normal title…
is this possible?
you can see it here: https://tagebuch.innovationsraum.de/
thanks a lot!
-
interesting! we’ll look into this and get back to you with a solution. thanks for the feedback!
Ah ha! Can you provide an example of how exactly you are using the shortcode? It seems you have multiple nested collapseomatic elements:
<div class="collapseomatic colomat-open" rel="animal-highlander" id="461"> <span class="collapseomatic " id="id2435" tabindex="" title="Inhalt anzeigen">Inhalt anzeigen</span> <span id="swap-id2435" alt="" class="colomat-swap" style="display:none;">Inhalt ausblenden</span> </div>
So the highlander is being assigned to the outer collapseomatic div element, but the swaptitle is associated with the nested collapseomatic span element.
Hey, we use 2 queries…
<?php /** * The main template file for display blog page. * * @package WordPress */ /** * Get Current page object **/ if(!is_null($post)) { $page_obj = get_page($post->ID); } $current_page_id = ''; /** * Get current page id **/ if(!is_null($post) && isset($page_obj->ID)) { $current_page_id = $page_obj->ID; } get_header(); $is_standard_wp_post = FALSE; if(is_tag()) { $is_standard_wp_post = TRUE; } elseif(is_category()) { $is_standard_wp_post = TRUE; } elseif(is_archive()) { $is_standard_wp_post = TRUE; } get_header(); //Include post featured slider $tg_blog_slider_layout = kirki_get_option('tg_blog_slider_layout'); if(THEMEDEMO && isset($_GET['layout']) && $_GET['layout'] == '2cols') { $tg_blog_slider_layout = 'fixed-slider'; } get_template_part("/templates/template-".$tg_blog_slider_layout); if(is_category() OR is_tag() OR is_archive()) { get_template_part("/templates/template-header"); } else { ?> <div id="page_content_wrapper"> <?php } ?> <div class="inner two_cols"> <!-- Begin main content --> <div class="inner_wrapper"> <div class="sidebar_content full_width two_cols"> <?php //Include post search bar get_template_part("/templates/template-search"); query_posts('cat=1&showposts=6'); $key = 0; if (have_posts()) : while (have_posts()) : the_post(); $image_thumb = ''; $key++; if(has_post_thumbnail(get_the_ID(), 'large')) { $image_id = get_post_thumbnail_id(get_the_ID()); $image_thumb = wp_get_attachment_image_src($image_id, 'large', true); } ?> <!-- Begin each blog post --> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php if($key%2==0) { ?>data-column="last"<?php } ?>> <div class="post_wrapper"> <div class="post_content_wrapper"> <div class="post_header"> <?php if(!empty($image_thumb)) { $small_image_url = wp_get_attachment_image_src($image_id, 'letsblog_blog_thumb', true); ?> <div class="post_img static"> <img src="<?php echo esc_url($small_image_url[0]); ?>" alt="" class="" style="width:<?php echo esc_attr($small_image_url[1]); ?>px;height:<?php echo esc_attr($small_image_url[2]); ?>px;"/> </div> <?php } ?> <br class="clear"/> <?php //echo '<p>'.letsblog_get_excerpt_by_id(get_the_ID()).'</p>'; ?> <h3 class="front-small-header frontpage-blog" id="<?php the_ID(); ?>"> <?php the_title(); ?> </h3> <div class="collapseomatic colomat-open" rel="animal-highlander" id="<?php the_ID(); ?>"> <?php echo do_shortcode('[expand title="Inhalt anzeigen" swaptitle="Inhalt ausblenden"][/expand]'); ?> </div> <div id="target-<?php the_ID(); ?>" class="collapseomatic_content" > <?php the_content();?> </div> <!--<div class="post_button_wrapper"> <a>"><?php //echo _e( 'weiterlesen', THEMEDOMAIN ); ?></a> </div>--> </div> </div> </div> </div> <!-- End each blog post --> <?php endwhile; endif; ?> <?php query_posts('cat=27&showposts=2'); $key = 0; if (have_posts()) : while (have_posts()) : the_post(); $image_thumb = ''; $key++; if(has_post_thumbnail(get_the_ID(), 'large')) { $image_id = get_post_thumbnail_id(get_the_ID()); $image_thumb = wp_get_attachment_image_src($image_id, 'large', true); } ?> <!-- Begin each blog post --> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php if($key%2==0) { ?>data-column="last"<?php } ?>> <div class="post_wrapper"> <div class="post_content_wrapper"> <div class="post_header"> <?php if(!empty($image_thumb)) { $small_image_url = wp_get_attachment_image_src($image_id, 'letsblog_blog_thumb', true); ?> <div class="post_img static"> <img src="<?php echo esc_url($small_image_url[0]); ?>" alt="" class="" style="width:<?php echo esc_attr($small_image_url[1]); ?>px;height:<?php echo esc_attr($small_image_url[2]); ?>px;"/> </div> <?php } ?> <br class="clear"/> <?php //echo '<p>'.letsblog_get_excerpt_by_id(get_the_ID()).'</p>'; ?> <h3 class="front-small-header frontpage-blog" id="<?php the_ID(); ?>"> <?php the_title(); ?> </h3> <div class="collapseomatic colomat-open" rel="animal-highlander" id="<?php the_ID(); ?>"> <?php echo do_shortcode('[expand title="Inhalt anzeigen" swaptitle="Inhalt ausblenden"][/expand]'); ?> </div> <div id="target-<?php the_ID(); ?>" class="collapseomatic_content "> <?php the_content();?> <a href="/news">zum News Archiv</a> </div> <!--<div class="post_button_wrapper"> <a>"><?php //echo _e( 'weiterlesen', THEMEDOMAIN ); ?></a> </div>--> </div> </div> </div> </div> <!-- End each blog post --> <?php endwhile; endif; ?> <div class="pagination"> <p> <?php posts_nav_link(' ', '<i class="fa fa-angle-double-left"></i>'.__( 'Newer Posts', THEMEDOMAIN ), __( 'Older Posts', THEMEDOMAIN ).'<i class="fa fa-angle-double-right"></i>'); ?> </p> </div> </div> </div> <!-- End main content --> </div> </div> <?php get_footer(); ?>
Wow, that was quite a bit of code you posted.
OK, the issue is simple. you need to change this bit:<div class="collapseomatic colomat-open" rel="animal-highlander" id="<?php the_ID(); ?>"> <?php echo do_shortcode('[expand title="Inhalt anzeigen" swaptitle="Inhalt ausblenden"][/expand]'); ?> </div> <div id="target-<?php the_ID(); ?>" class="collapseomatic_content ">...
to this:
<div class="collapseomatic colomat-open" rel="animal-highlander" id="<?php the_ID(); ?>">Inhalt anzeigen</div> <div id="swap-<?php the_ID(); ?>" class="colomat-swap" style="display:none;">Inhalt ausblenden</div> <div id="target-<?php the_ID(); ?>" class="collapseomatic_content ">...
Basically you are creating the entire roll-your-own collapse element, including the swap title.
Does this make sense?Hey, thanks a lot…i changed your lines, but had to change this line from
<h3 class=”front-small-header frontpage-blog” id=”<?php the_ID(); ?>”>
to this
<h3 class=”front-small-header frontpage-blog”>
and it works!!!
yeah! good job on getting this working. Issue marked as resolved. if you are happy and you know it, consider leaving a short review.
Thanks a lot!!!
- The topic ‘rel="animal-highlander" with swaptitle’ is closed to new replies.