WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing title hyperlink (2 posts)

  1. accretio
    Member
    Posted 2 years ago #

    Hi, I need some help with editing the function.php theme file.
    I would like to stop wordpress from hyperlinking the titles of my front pages.

    Please tell me what to remove from this code in order to do so:

    **
     * Remove links from entry titles (shortcodes)
     *
     */
    function oxygen_entry_title_shortcode( $title ) {
    
    	global $post;
    
    	if ( is_front_page() && !is_home() ) {
    		$title = the_title( '<h2 class="' . esc_attr( $post->post_type ) . '-title entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>', false );
    	} elseif ( is_singular() ) {
    		$title = the_title( '<h1 class="' . esc_attr( $post->post_type ) . '-title entry-title">', '</h1>', false );
    	} elseif ( 'link_category' == get_query_var( 'taxonomy' ) ) {
    		$title = false;
    	} else {
    		$title = the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>', false );
    	}
    
    	/* If there's no post title, return a clickable '(Untitled)'. */
    	if ( empty( $title ) && !is_singular() && 'link_category' !== get_query_var( 'taxonomy' ) )
    		$title = '<h2 class="entry-title no-entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . __( '(Untitled)', 'origin' ) . '</a></h2>';		
    
    	return $title;
    }

    Please help me out here guys, I'm really having trouble with this.

    Thanks

  2. adpawl
    Member
    Posted 2 years ago #

    if ( is_front_page() && !is_home() ) {
    $title = the_title( '<h2 class="' . esc_attr( $post->post_type ) . '-title entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>', false );
    }

    change to

    if ( is_front_page() && !is_home() ) {
    $title = the_title( '<h2 class="' . esc_attr( $post->post_type ) . '-title entry-title">', '</h2>', false );
    }

Topic Closed

This topic has been closed to new replies.

About this Topic