- This topic has 3 replies, 2 voices, and was last updated 8 years, 1 month ago by Mahesh.
-
AuthorPosts
-
November 10, 2016 at 8:56 pm #103114HenriëtParticipant
Hello, thank you for reading!
I’m using Gridalicious-Pro.
I am trying to move the category/tag tags from the bottom of a blog post to the top of it, right after the date.
This both on the single post page, and category/blog page (archive?), so everywhere.I would also like to remove the author-tag completely – as there’s just me writing and there’s simply no need for it.
Could you please let me know if this is possible, and how I could do this best? I am using a child-theme, and I am hoping for a php-snippet for my functions.php for this! I’d rather not edit the core files. 🙂
Thank you for your help!
Best regards,
HenriëtPS
I have seen this: https://catchthemes.com/support-forum/topic/author-tags/ and that helped; by commenting out the author-tag part I could remove the author. It just felt like a huge work-around and not the best way for my purpose though.
The same goes for “display: none;” which works with removing the category tag at the bottom – but of course won’t make it show up at the top instead.
I’ve been looking for hooks, but couldn’t find them… My php-skills are just basic, I’m afraid.November 11, 2016 at 9:48 am #103153MaheshParticipant@gmg-jet: As you’ve already created the child theme. Add the following code in you child theme’s
functions.php
function gridalicious_entry_meta() { echo '<p class="entry-meta">'; $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); printf( '<span class="posted-on">%1$s<a href="%2$s" rel="bookmark">%3$s</a></span>', sprintf( __( '<span class="screen-reader-text">Posted on</span>', 'gridalicious-pro' ) ), esc_url( get_permalink() ), $time_string ); if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( esc_html__( 'Leave a comment', 'gridalicious-pro' ), esc_html__( '1 Comment', 'gridalicious-pro' ), esc_html__( '% Comments', 'gridalicious-pro' ) ); echo '</span>'; } edit_post_link( esc_html__( 'Edit', 'gridalicious-pro' ), '<span class="edit-link">', '</span>' ); echo '</p><!-- .entry-meta -->'; }
Then create a new file and save it as
content.php
in your child theme, then copy the following codes into it.<?php /** * The default template for displaying content * * Used for both single and index/archive/search * * @package Catch Themes * @subpackage Gridalicious * @since Gridalicious 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="archive-post-wrap"> <?php /** * gridalicious_before_entry_container hook * * @hooked gridalicious_archive_content_image - 10 */ do_action( 'gridalicious_before_entry_container' ); ?> <div class="entry-container"> <header class="entry-header"> <h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1> <?php if ( 'post' == get_post_type() ) : ?> <?php gridalicious_entry_meta(); ?> <?php gridalicious_tag_category(); ?> <?php endif; ?> </header><!-- .entry-header --> <?php $options = gridalicious_get_theme_options(); if ( is_search() || 'full-content' != $options['content_layout'] ) : // Only display Excerpts for Search and if 'full-content' is not selected ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php else : ?> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="pages">' . __( 'Pages:', 'gridalicious-pro' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', ) ); ?> </div><!-- .entry-content --> <?php endif; ?> </div><!-- .entry-container --> </div><!-- .archive-post-wrap --> </article><!-- #post -->
Regards,
MaheshNovember 11, 2016 at 5:32 pm #103177HenriëtParticipantHello Mahesh,
Thank you very much for your help!Noticed that the part for the author was indeed what I had seen previously, so I’m very happy to know that that was the best way indeed 🙂
The second part for the category tags worked, but not completely as I had intended. It didn’t seem to work on the post itself (category was still at bottom), but the biggest problem was that the tag did not appear on the same line as the date.
However, I did help me further!
Guided by your solutions, I discovered that both the lines for date and category were <p class=”meta-entry”> and so I went looking for a way to combine them. After several attemps I managed to include the category into your code given to remove the author.
In the gridalicous-core.php I then found the function that defined gridalicious_tag_category, and it turned out to be a <p> indeed, causing it to appear on a line by itself.
Copied that part above the given code, replaced, <p> with <span> and that did the trick!Everything is neatly on the same line now, and I didn’t need to use the content.php file anymore. Removed the tags at the bottom by css. 🙂
Thank you very much for helping me out 😀
Best regards and much appreciation for your help,
HenriëtNovember 13, 2016 at 5:20 pm #103229 -
AuthorPosts
- The topic ‘Category Tag & Author Tag in blog posts’ is closed to new replies.