- This topic has 10 replies, 3 voices, and was last updated 4 years, 11 months ago by Tom.
-
AuthorPosts
-
April 25, 2019 at 4:10 pm #879750Steig
Hello,
I’d like to make it so that the post date isn’t clickable. Is that possible?
Thanks!
April 25, 2019 at 4:22 pm #879764SteigLet’s make it so the author isn’t clickable either.
April 25, 2019 at 4:47 pm #879781TomLead DeveloperLead DeveloperTo remove it from the date, this should help: https://docs.generatepress.com/article/generate_post_date_output/#remove-link-from-date
For the author: https://docs.generatepress.com/article/generate_post_author_output/#remove-link
Hope this helps ๐
April 25, 2019 at 5:16 pm #879787SteigI’ve put both those into the simple css window and they aren’t removing the links.
April 26, 2019 at 2:03 am #880088DavidStaffCustomer SupportHi there,
that code is PHP. This article explains ways to add that:
https://docs.generatepress.com/article/adding-php/
It contains a link to the Code Snippets plugin which is easiest method if you don’t have a child theme.
April 26, 2019 at 5:41 am #880291SteigI’m running a child theme and put that code into functions.php. The result has removed clickability, but the post date is shown twice, back to back.
<?php /** * GeneratePress child theme functions and definitions. * * Add your custom PHP in this file. * Only edit this file if you have direct access to it on your server (to fix errors if they happen). */ function generatepress_child_enqueue_scripts() { if ( is_rtl() ) { wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' ); } } add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 ); /* remove link from date */ add_filter( 'generate_post_date_output','tu_remove_date_link', 10, 2 ); function tu_remove_date_link( $output, $time_string ) { printf( '%s', $time_string ); } /* remove link from post author */ add_filter( 'generate_post_author_output', function() { printf( ' %1$s', sprintf( '%1$s %4$s', __( 'by','generatepress'), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ) ) ); } );
April 26, 2019 at 9:22 am #880644TomLead DeveloperLead DeveloperDo you have any other custom functions on the site? Using the Code Snippets plugin maybe?
April 26, 2019 at 9:53 am #880691SteigThe only other customization I’m aware of what changing the content.php file as follows:
<?php /** * The template for displaying posts within the loop. * * @package GeneratePress */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>> <div class="inside-article"> <?php /** * generate_before_content hook. * * @since 0.1 * * @hooked generate_featured_page_header_inside_single - 10 */ do_action( 'generate_before_content' ); ?> <header class="entry-header"> <?php /** * generate_before_entry_title hook. * * @since 0.1 */ do_action( 'generate_before_entry_title' ); the_title( sprintf( '<h2 class="entry-title" itemprop="headline"><a class="sg-iframe-popup-133" href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); /** * generate_after_entry_title hook. * * @since 0.1 * * @hooked generate_post_meta - 10 */ do_action( 'generate_after_entry_title' ); ?> </header><!-- .entry-header --> <?php /** * generate_after_entry_header hook. * * @since 0.1 * * @hooked generate_post_image - 10 */ do_action( 'generate_after_entry_header' ); if ( generate_show_excerpt() ) : ?> <div class="entry-summary" itemprop="text"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php else : ?> <div class="entry-content" itemprop="text"> <?php the_content(); wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'after' => '</div>', ) ); ?> </div><!-- .entry-content --> <?php endif; /** * generate_after_entry_content hook. * * @since 0.1 * * @hooked generate_footer_meta - 10 */ do_action( 'generate_after_entry_content' ); /** * generate_after_content hook. * * @since 0.1 */ do_action( 'generate_after_content' ); ?> </div><!-- .inside-article --> </article><!-- #post-## -->
This was to make it so that each post detail page shows as a popup.
April 26, 2019 at 6:52 pm #881042TomLead DeveloperLead DeveloperIt looks like the functions you added in your child theme are missing various elements from the examples on the pages I linked you to. Can you re-add them and make sure everything looks the same?
April 26, 2019 at 6:56 pm #881048SteigThat did it; sorry about that.
April 27, 2019 at 7:10 am #881468TomLead DeveloperLead DeveloperNo problem! ๐
-
AuthorPosts
- You must be logged in to reply to this topic.