WordPress.org

Ready to get started?Download WordPress

Forums

Where is html stored? (17 posts)

  1. accretio
    Member
    Posted 2 years ago #

    Hi, I am looking for the following code in my theme:

    <h2 class="page-title entry-title">
    <a rel="bookmark" title="Introducing: NipponReview" href="http://nipponreview.kdmonline.co.za/">Introducing: NipponReview</a>

    In what .php file can it be found? Please help, I'm desperate.

    Thanks

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    It depends upon your theme. Try looking in index.php or page.php.

  3. David Gwyer
    Member
    Posted 2 years ago #

    Or possibly a loop.php file.

  4. accretio
    Member
    Posted 2 years ago #

    Okay, thanks guys. Will have a look and let you know.

  5. accretio
    Member
    Posted 2 years ago #

    Bad news, can't find it in either of the 3 files. Any other suggestions? Please guys, I'm really desperate!

  6. David Gwyer
    Member
    Posted 2 years ago #

    The title is probably being generated during the page load so I doubt you will find the exact text in any of your php files.

  7. accretio
    Member
    Posted 2 years ago #

    Okay, I think you're right David.

    What I'm trying to is remove the hyperlink from the title "Introducing: NipponReview" and make it red.

    Here is a link: http://nipponreview.kdmonline.co.za

    I also want all the static page titles to be this way in future.

    How would I go about doing this? Any help would really be appreciated.

  8. David Gwyer
    Member
    Posted 2 years ago #

    Just search your theme template files for the CSS classes page-title entry-title. Where you find these just remove the link tag that wraps around the title.

    To make it red you need to modify your styles but you will have to edit your style.css. I would recommend doing this in a child theme to preserve your changes. Or at the very least backup your theme first.

  9. Phil
    Member
    Posted 2 years ago #

    There will be something in your page.php or single.php like this:

    <h2 class="page-title entry-title">
    <a rel="bookmark" title="<?php the_title(); ?>" href=" <?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    You basically want to edit it without the link:

    <h2 class="page-title entry-title"><?php the_title(); ?></h2>

    Hope that helps!

  10. Phil
    Member
    Posted 2 years ago #

    To make it red, open style.css and add:

    h2.page-title {
    color: #cc0000;
    }

  11. accretio
    Member
    Posted 2 years ago #

    Thanks guys, will try your suggestions and let you know...

  12. accretio
    Member
    Posted 2 years ago #

    Bad news again. Phil, I searched through both page.php and single.php and I couldn't find find any of the code that you provided.

    And David, I also searched for the those two things and I couldn't find them as well.

    Please guys, could you help me some more?

  13. Phil
    Member
    Posted 2 years ago #

    functions.php:

    /**
     * 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 );
    	}

    Just remove the a tags...

    :)

  14. accretio
    Member
    Posted 2 years ago #

    Okay, thanks Phil. Will try it out and let you know like before.

  15. accretio
    Member
    Posted 2 years ago #

    Thanks so much Phil, I think I'm on the right track now. But I'm still having some trouble with the code. What exactly should I remove from it?

    Here is the code from my side:

    **
     * 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;
    }

    Sorry for asking all these questions, but I really need your help.

    Thanks

  16. Phil
    Member
    Posted 2 years ago #

    Try changing to this:

    **
     * 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">', '</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;
    }

    Do a backup of your functions.php file first incase you need to revert it back. All I've done here is remove the tags from the h2.

  17. accretio
    Member
    Posted 2 years ago #

    Thanks so much Phil, everything is sorted now.

Topic Closed

This topic has been closed to new replies.

About this Topic