[Resolved] Make post date not clickable

Home Forums Support [Resolved] Make post date not clickable

Home Forums Support Make post date not clickable

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #879750
    Steig

    Hello,

    I’d like to make it so that the post date isn’t clickable. Is that possible?

    Thanks!

    GeneratePress 2.2.2
    GP Premium 1.8.1
    #879764
    Steig

    Let’s make it so the author isn’t clickable either.

    #879781
    Tom
    Lead Developer
    Lead Developer
    #879787
    Steig

    I’ve put both those into the simple css window and they aren’t removing the links.

    #880088
    David
    Staff
    Customer Support

    Hi 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.

    #880291
    Steig

    I’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() )
            ) 
        );
    } );
    #880644
    Tom
    Lead Developer
    Lead Developer

    Do you have any other custom functions on the site? Using the Code Snippets plugin maybe?

    #880691
    Steig

    The 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.

    #881042
    Tom
    Lead Developer
    Lead Developer

    It 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?

    #881048
    Steig

    That did it; sorry about that.

    #881468
    Tom
    Lead Developer
    Lead Developer
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.