• Resolved sumierm

    (@sumierm)


    Hello, I have a problem with one of my group names. I added a shortcode next to the name from the dashboard to display a verified badge. It works perfectly except for on the main group page. It displays the actual code instead of the badge. Does anyone know a fix to either hide the code or get the badge to display. I would prefer the badge to be displayed though. You can see what i mean here:
    https://connectioninterface.com/groups-2/verified/
    This what it looks like on another page (this is what i want)
    https://connectioninterface.com/groups-2/
    Thanks

Viewing 15 replies - 1 through 15 (of 19 total)
  • That’s because headings don’t (by default) parse shrotcodes. That only happens (by default) in content.

    You can change this pretty easily though. In your pages template file you’ll see the H1 tag being output, and you’ll just need to add something like this:

    <h1><?php echo do_shortcode( apply_filters( 'the_title', $post->post_title ) ); ?></h1>

    It’s the do_shortcode() function that will output the actual shortcode.

    Note that this is purely an example, and your theme may have code that looks a bit different to this, so if you are not sure, let us know what the code is for your theme.

    Another way of doing it that may suit you better is to add a filter in for the_title and add the badges on using that filter instead of modifying the templage file in any way.

    Thread Starter sumierm

    (@sumierm)

    Hello, thanks for responding, i dont see the h1 tags. This is what the page template (page.php) looks like:

    <?php
    /**
    * The template for displaying all pages
    *
    * This is the template that displays all pages by default.
    * Please note that this is the WordPress construct of pages
    * and that other ‘pages’ on your WordPress site will use a
    * different template.
    *
    * @package Ribosome
    */

    get_header(); ?>

    <div id=”primary” class=”site-content”>
    <div id=”content” role=”main”>

    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( ‘content’, ‘page’ ); ?>
    <?php comments_template( ”, true ); ?>
    <?php endwhile; // end of the loop. ?>

    </div><!– #content –>
    </div><!– #primary –>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    First, when you’re posting code in here, you should use the code button above so that it will add in the right characters to display the code the right way. Without using that your code can very easily be broken.

    The H1 tag isn’t in that file. Where you’ll find it is part of this line:

    <?php get_template_part( 'content', 'page' ); ?>

    That’s telling the file to include another template file called content-page.php. As a fallback if that’s not there it will use content.php. Check out the Template Hierarchy for more info.

    Thread Starter sumierm

    (@sumierm)

    Ok, sorry im kinda new to this, do i put the code you gave me after that line or do i replace that line?

    No…

    You open the file content-page.php and find the H1 tag in there. Then you’ll be able to replace what’s in it in that file.

    Thread Starter sumierm

    (@sumierm)

    Great! That worked, thank you.

    Thread Starter sumierm

    (@sumierm)

    Hello, i just ran into another problem. The badge is not displayed in the site-wide activity. It shows the shortcode. Is there a fix for this.

    There woudl be. You’ll have to update the code in the same way (but most likely without the H1 tags) in which ever template file has that part of the code in it.

    Thread Starter sumierm

    (@sumierm)

    Ok, do you know what file that might be in?

    I couldn’t say. It could be part of the theme or a plugin, but I’d say it’s the theme. What theme are you using?

    Thread Starter sumierm

    (@sumierm)

    Ribosome

    Thread Starter sumierm

    (@sumierm)

    @catacaustic is possible it is in the content.php?

    <?php
    /**
     * The default template for displaying content
     *
     * @package Ribosome
     */
    ?>
    
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    		<?php if ( is_sticky() && is_home() ){
    			get_template_part( RIBOSOME_TEMPLATE_PARTS . 'sticky');
    		}else{ ?>
    
    		<?php if ( is_single() || ( is_home() && get_theme_mod('ribosome_contenido_completo_entradas_pp', '') == 1 )  ) : ?>
    		<header class="entry-header">
    			<div class="entry-title-subtitle">
    				<?php if ( is_single() ) { ?>
    					<h1 class="entry-title"><?php the_title(); ?></h1>
    				<?php }else{ ?>
    					<h2 class="entry-title"><?php the_title(); ?></h2>
    				<?php } ?>
    
    				<!-- Author, date and comments -->
    				<div class='sub-title'>
    					<div class="autor-fecha">
    						<span class="autor-in-full-posts"><i class="fa fa-user"></i> <a href='<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>'><?php the_author() ?></a>&nbsp;&nbsp;</span>
    						<span class="fecha-in-full-posts">
    							<i class="fa fa-calendar-o"></i> <?php echo get_the_date(); ?>&nbsp;&nbsp;
    						</span>
    						<span class="comments-in-full-posts">
    							<i class="fa fa-comment-o"></i> <?php comments_popup_link(); ?>
    						</span>
    					</div><!-- autor-fecha -->
    				</div><!-- .sub-title -->
    			</div><!-- .entry-title-subtitle -->
    		</header><!-- .entry-header -->
    		<?php endif; // is_single() ?>
    
    		<!-- Subtitle widget area -->
    		<?php if (is_single()) { ?>
    			<div class="sub-title-widget-area">
    				<?php if (!dynamic_sidebar ('wt-sub-title')) {} ?>
    			</div><!-- .sub-title-widget-area -->
    		<?php }?>
    
    		<?php //if (  is_home() || is_search() || is_category() || is_tag() || is_author() || is_archive() ) : // Only display Excerpts ?>
    		<?php if (  ( is_search() || is_category() || is_tag() || is_author() || is_archive() )
    		||  (is_home() && get_theme_mod('ribosome_contenido_completo_entradas_pp', '') == '' ) ) : // Only display Excerpts ?>
    
    			<div class="excerpt-wrapper"><!-- Excerpt -->
    
    				<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>
    						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark" >
    							<div class="wrapper-excerpt-thumbnail">
    								<?php
    								if (get_theme_mod('ribosome_thumbnail_rounded', '') == '') {
    									the_post_thumbnail('ribosome-excerpt-thumbnail');
    								}else{
    									the_post_thumbnail('ribosome-excerpt-thumbnail-rounded');
    								}
    								?>
    							</div>
    						</a>
    				<?php endif;?>
    
    				<header class="entry-header">
    					<h2 class="entry-title">
    					<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
    					</h2>
    					<?php
    					if (get_theme_mod( 'ribosome_show_meta_in_excerpts', '' ) == 1) { ?>
    						<div class='sub-title'>
    							<div class="autor-fecha">
    								<span class="autor-in-excerpts"><i class="fa fa-user"></i> <a href='<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>'><?php the_author() ?></a>&nbsp;&nbsp;</span>
    								<span class="fecha-in-excerpts">
    									<i class="fa fa-calendar-o"></i> <?php echo get_the_date(); ?>&nbsp;&nbsp;
    								</span>
    								<span class="comments-in-excerpts">
    									<i class="fa fa-comment-o"></i> <?php comments_popup_link(); ?>
    								</span>
    							</div><!-- autor-fecha -->
    						</div><!-- .sub-title -->
    					<?php } ?>
    				</header>
    
    				<?php the_excerpt(); ?>
    
    			</div><!-- .excerpt-wrapper -->
    
    		<?php else : ?>
    
    			<div class="entry-content">
    				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'ribosome' ) ); ?>
    				<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'ribosome' ), 'after' => '</div>' ) ); ?>
    			</div><!-- .entry-content -->
    
    		<?php endif; ?>
    
    		<footer class="entry-meta">
    			<!-- Post end widget area -->
    			<?php if (is_single()) : ?>
    				<div class="post-end-widget-area">
    					<?php if (!dynamic_sidebar ('wt-post-end')) {}?>
    				</div>
    			<?php endif; ?>
    
    			<?php if ( is_single() || ( is_home() && get_theme_mod('ribosome_contenido_completo_entradas_pp', '') == 1 )  ) { ?>
    				<div class="entry-meta-term-single">
    			<?php
    			}else{
    			?>
    				<div class="entry-meta-term-excerpt">
    			<?php
    			} ?>
    
    				<span class="term-icon"><i class="fa fa-folder-open"></i></span> <?php echo get_the_term_list ($post->ID,'category', '', ', ',''); ?>
    
    				<?php $post_tags = get_the_term_list($post->ID,'post_tag');
    				if ($post_tags) { ?>
    				&nbsp;&nbsp;&nbsp;<span class="term-icon"><i class="fa fa-tags"></i></span> <?php echo get_the_term_list ($post->ID,'post_tag', '', ', ','');
    				}?>
    
    				<div style="float:right;"><?php edit_post_link( __( 'Edit', 'ribosome' ), '<span class="edit-link">', '</span>' ); ?></div>
    			</div><!-- .entry-meta-term -->
    
    			<?php
    			// Related posts
    			if ( is_single() && get_theme_mod('ribosome_related_posts', '') == 1) get_template_part( RIBOSOME_TEMPLATE_PARTS . 'related-posts'); ?>
    
    			<?php if ( is_singular() && get_the_author_meta( 'description' ) ) : ?>
    				<div class="author-info">
    					<div class="author-avatar">
    						<?php
    						/** This filter is documented in author.php */
    						$author_bio_avatar_size = apply_filters( 'ribosome_author_bio_avatar_size', 90 );
    						echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
    						?>
    					</div><!-- .author-avatar -->
    					<div class="author-description">
    						<h2><?php printf( __( 'About %s', 'ribosome' ), get_the_author() ); ?></h2>
    						<p><?php the_author_meta( 'description' ); ?></p>
    						<div class="author-link">
    							<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
    								<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'ribosome' ), get_the_author() ); ?>
    							</a>
    						</div><!-- .author-link	-->
    					</div><!-- .author-description -->
    				</div><!-- .author-info -->
    			<?php endif;
    			} // if ( is_sticky() && is_home() )?>
    		</footer><!-- .entry-meta -->
    	</article><!-- #post -->

    Thread Starter sumierm

    (@sumierm)

    Do you have a fix for my problem?

    There’s no shortcodes anywhere in that file.

    Is the shortcode for that provided by the theme or by a different plugin?

    The reason for asking that is that you should really ask the question in the support forum for the theme (if it’s provided by the theme) or the plugin (if it’s provided by the plugin).

    I couldn’t see anywhere on the themes page where it says about shortcodes like this so I’d guess that it’s controlled by a plugin.

    Thread Starter sumierm

    (@sumierm)

    Ok, do you know how to display the number of messages and notifications next to the menu tab. See what i mean:
    https://connectioninterface.com/
    Username: test
    Password: test

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Shortcode problem’ is closed to new replies.