New answers tagged

2

On the top of my head there are two easy ways to go about this problem, first is to use the get_the_tags() function to manually loop the tags to easily insert the hashtags. $tags = get_the_tags(); if ( $tags ) { foreach ( $tags as $tag ) { ?> <a href="<?php echo get_tag_link( $tag->id ); ?>"> <?php echo '#' ...


0

Add this in your functions.php file: function wpse225250_filter_post_tags($terms, $post_id, $taxonomy) { if ( is_admin() || ('post_tag' !== $taxonomy) ) return $terms; foreach ($terms as $term) { $term->name = '#' . $term->name; } return $terms; } add_filter('get_the_terms', 'wpse225250_filter_post_tags', 10, 3); To ...


0

To add to what @brasofilo answered 3 years ago, this is what is necessary in the current menu system (WP v4.5.1). add_action( 'admin_head-edit-tags.php', 'modify_menu_highlight_wpse_43839' ); function modify_menu_highlight_wpse_43839() { if( 'post_tag' == $_GET['taxonomy'] ) { ?> <script type="text/javascript"> ...


0

Make sure you're inside the loop. <?php while ( have_posts() ) : the_post(); ?> <?php if ( get_post_type() == 'page' ) : ?> <?php /* well, this is a page */ ?> <?php else : ?> <?php /* any other post_type like post, attachment other CTP */ ?> <?php endif; ?> <?php endwhile; ?> Like Rarst suggested ...


0

You are making typical mistake between conditional tags which tell you which kind of page are you on (search in your case) and functions which tell you data of the current post in the loop. What you want in this case is probably get_post_type() and make your output conditional on result of it.


0

You should you this plug in instead: Category Image And don't be shy learning and using printf, it's worth. printf( '<a class="%1$s" href="%2$s"><img class="img-class" src="%4$s" <h3>%3$s</h3></a>', sanitize_html_class( $class_name ), get_tag_link( $tag->term_id ), sprintf( __( '%s') , $tag->name ), ...


1

Try this: $args = array( 'taxonomy' => 'post_tag', 'hide_empty' => 0 ); $tags = get_terms( $args ); $class_name = 'my-custom-class-name'; if ( ! empty( $tags ) && ! is_wp_error( $tags ) ) { shuffle( $tags ); foreach( array_slice( $tags, 0, 6 ) as $tag ) { printf( '<a class="%1$s" href="%2$s">%3$s</a>', ...


-1

Use below code please, this will work. <a href="<?php the_permalink(); ?>">read more..</a> or <?php the_content( __( 'more <span class="meta-nav">...</span>', 'themename' ) ); ?>



Top 50 recent answers are included