- This topic has 9 replies, 2 voices, and was last updated 10 years, 9 months ago by telexesposito.
-
AuthorPosts
-
March 11, 2014 at 5:19 pm #21164telexespositoMember
Hello,
in tools for the webmaster by Bing, SEO analyzer tells me that there are two H1 tags.
The first is the logo of the site, the second is the title.I would like to eliminate the H1 logo because it is an image.
Which file should I change and how?
I can post the code if required.
thanksMarch 11, 2014 at 11:08 pm #21175SakinKeymaster@telexesposito: You need to build child theme and then create functions.php file in your child theme and copy
simplecatch_headerdetails
function code from simplecatch_functions.php file to your child theme functions.php file and edit it as per you need.March 11, 2014 at 11:23 pm #21178telexespositoMemberhello, thanks for the reply.
I already have a child theme that I have made several changes.I need to know where to find the H1 tag to remove it. Thanks
March 11, 2014 at 11:25 pm #21179SakinKeymaster@telexesposito: You can just copy the following code in your child theme functions.php file and edit as per your need.
<?php /** * Get the header logo Image from theme options * * @uses header logo * @get the data value of image from theme options * @display Header Image logo * * @uses default logo if logo field on theme options is empty * * @uses set_transient and delete_transient */ function simplecatch_headerdetails() { //delete_transient( 'simplecatch_headerdetails' ); global $simplecatch_options_settings; $options = $simplecatch_options_settings; if ( ( !$simplecatch_headerdetails = get_transient( 'simplecatch_headerdetails' ) ) && ( !empty( $options[ 'featured_logo_header' ] ) || empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) ) { echo '<!-- refreshing cache -->'; $simplecatch_headerdetails = '<div class="logo-wrap">'; if( empty ($options[ 'remove_header_logo' ] ) ) { $simplecatch_headerdetails .= '<h1 id="site-logo"><a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">'; // if not empty featured_logo_footer on theme options if ( !empty( $options[ 'featured_logo_header' ] ) ) : $simplecatch_headerdetails .= '<img src="'.esc_url( $options[ 'featured_logo_header' ] ).'" alt="'.get_bloginfo( 'name' ).'" />'; else: // if empty featured_logo_footer on theme options, display default Header Logo $simplecatch_headerdetails .='<img src="'. get_template_directory_uri().'/images/logo-head.png" alt="logo" />'; endif; $simplecatch_headerdetails .= '</a></h1>'; } if( empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) { $simplecatch_headerdetails .= '<div id="site-details">'; if ( empty( $options[ 'remove_site_title' ] ) ) { $simplecatch_headerdetails .= '<h1 id="site-title"><a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">'.esc_attr( get_bloginfo( 'name', 'display' ) ).'</a></h1>'; } if ( empty( $options[ 'remove_site_description' ] ) ) { $simplecatch_headerdetails .= '<h2 id="site-description">'.esc_attr( get_bloginfo( 'description' ) ).'</h2>'; } $simplecatch_headerdetails .= '</div><!-- .site-details -->'; } $simplecatch_headerdetails .= '</div><!-- .logo-wrap -->'; set_transient( 'simplecatch_headerdetails', $simplecatch_headerdetails, 86940 ); } echo $simplecatch_headerdetails; }
March 12, 2014 at 12:28 am #21186telexespositoMemberIn my functions.php file (I copied the files from the folder simple-catch to simple-catch-CHILD) I have this code that is different from yours. If I delete my code and insert your own, I have so many errors.
<?php /** * Simple Catch functions and definitions * * Sets up the theme and provides some helper functions. Some helper functions * are used in the theme as custom template tags. Others are attached to action and * filter hooks in WordPress to change core functionality. * * The first function, simplecatch_setup(), sets up the theme by registering support * for various features in WordPress, such as post thumbnails, navigation menus, and the like. * * @package Catch Themes * @subpackage Simple_Catch * @since Simple Catch 1.0 */ /** * Set the content width based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 642; /** * Tell WordPress to run simplecatch_setup() when the 'after_setup_theme' hook is run. */ add_action( 'after_setup_theme', 'simplecatch_setup' ); if ( !function_exists( 'simplecatch_setup' ) ): /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * @uses load_theme_textdomain() For localization support. * @uses add_theme_support() To add support for post thumbnails and automatic feed links. * @uses register_nav_menu() To add support for navigation menu. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since Simple Catch 1.0 */ function simplecatch_setup() { /* Simple Catch is now available for translation. * Add your files into /languages/ directory. * @see http://codex.wordpress.org/Function_Reference/load_theme_textdomain */ load_theme_textdomain( 'simplecatch', get_template_directory() . '/languages' ); $locale = get_locale(); $locale_file = get_template_directory().'/languages/$locale.php'; if (is_readable( $locale_file)) require_once( $locale_file); // Load up theme options defaults require( get_template_directory() . '/functions/simplecatch_themeoptions_defaults.php' ); // Load up our theme options page and related code. require( get_template_directory() . '/functions/panel/theme_options.php' ); // Grab Simple Catch's Custom Tags widgets. require( get_template_directory() . '/functions/widgets.php' ); // Load up our Simple Catch's Functions require( get_template_directory() . '/functions/simplecatch_functions.php' ); // Load up our Simple Catch's metabox require( get_template_directory() . '/functions/simplecatch_metabox.php' ); /** * This feature enables Jetpack plugin Infinite Scroll */ add_theme_support( 'infinite-scroll', array( 'type' => 'click', 'container' => 'content', 'render' => 'simplecatch_infinite_scroll_render', 'footer' => 'page' ) ); // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page. add_theme_support( 'post-thumbnails' ); /* We'll be using post thumbnails for custom features images on posts under blog category. * Larger images will be auto-cropped to fit. */ set_post_thumbnail_size( 210, 210 ); // Add Simple Catch's custom image sizes add_image_size( 'featured', 210, 210, true); // uses on homepage featured image add_image_size( 'slider', 976, 313, true); // uses on Featured Slider on Homepage Header // Add default posts and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); // remove wordpress version from header for security concern remove_action( 'wp_head', 'wp_generator' ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Primary Menu', 'simplecatch' ) ); // Add support for custom backgrounds // WordPress 3.4+ if ( function_exists( 'get_custom_header') ) { add_theme_support( 'custom-background' ); } else { // Backward Compatibility for WordPress Version 3.3 add_custom_background(); } //Redirect to Theme Options Page on Activation global $pagenow; if ( is_admin() && isset($_GET['activated'] ) && $pagenow =="themes.php" ) { wp_redirect( 'themes.php?page=theme_options' ); } } // simplecatch_setup endif;
March 12, 2014 at 9:10 am #21214SakinKeymaster@telexesposito: You shouldn’t copy the parent theme functions.php file to your child theme. You should create empty functions.php file and then you need copy the code I gave you. Remember one thing, you functions.php file should start with
<?php
If you forgot to add this then it will not work.March 12, 2014 at 7:37 pm #21249telexespositoMemberOk, maybe it works now!
Now I want to remove the logo in the H1 (<h1> id=”site-logo”>) how should I modify the code? I’m sorry but I’m not an expert on codes.f ( ( !$simplecatch_headerdetails = get_transient( 'simplecatch_headerdetails' ) ) && ( !empty( $options[ 'featured_logo_header' ] ) || empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) ) { echo '<!-- refreshing cache -->'; $simplecatch_headerdetails = '<div class="logo-wrap">'; if( empty ($options[ 'remove_header_logo' ] ) ) { $simplecatch_headerdetails .= '<h1 id="site-logo"><a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">';
March 12, 2014 at 9:32 pm #21252SakinKeymaster@telexesposito: I think you should better hire customizer to do advance coding. For now I am adding the code for you which replaces
<h1 class="logo-wrap">
to<div class="logo-wrap">
<?php /** * Get the header logo Image from theme options * * @uses header logo * @get the data value of image from theme options * @display Header Image logo * * @uses default logo if logo field on theme options is empty * * @uses set_transient and delete_transient */ function simplecatch_headerdetails() { delete_transient( 'simplecatch_headerdetails' ); global $simplecatch_options_settings; $options = $simplecatch_options_settings; if ( ( !$simplecatch_headerdetails = get_transient( 'simplecatch_headerdetails' ) ) && ( !empty( $options[ 'featured_logo_header' ] ) || empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) ) { echo '<!-- refreshing cache -->'; $simplecatch_headerdetails = '<div class="logo-wrap">'; if( empty ($options[ 'remove_header_logo' ] ) ) { $simplecatch_headerdetails .= '<div id="site-logo"><a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">'; // if not empty featured_logo_footer on theme options if ( !empty( $options[ 'featured_logo_header' ] ) ) : $simplecatch_headerdetails .= '<img src="'.esc_url( $options[ 'featured_logo_header' ] ).'" alt="'.get_bloginfo( 'name' ).'" />'; else: // if empty featured_logo_footer on theme options, display default Header Logo $simplecatch_headerdetails .='<img src="'. get_template_directory_uri().'/images/logo-head.png" alt="logo" />'; endif; $simplecatch_headerdetails .= '</a></div>'; } if( empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) { $simplecatch_headerdetails .= '<div id="site-details">'; if ( empty( $options[ 'remove_site_title' ] ) ) { $simplecatch_headerdetails .= '<h1 id="site-title"><a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">'.esc_attr( get_bloginfo( 'name', 'display' ) ).'</a></h1>'; } if ( empty( $options[ 'remove_site_description' ] ) ) { $simplecatch_headerdetails .= '<h2 id="site-description">'.esc_attr( get_bloginfo( 'description' ) ).'</h2>'; } $simplecatch_headerdetails .= '</div><!-- .site-details -->'; } $simplecatch_headerdetails .= '</div><!-- .logo-wrap -->'; set_transient( 'simplecatch_headerdetails', $simplecatch_headerdetails, 86940 ); } echo $simplecatch_headerdetails; }
March 12, 2014 at 9:37 pm #21254telexespositoMemberI put in your code above, without the h1 tag in <h1> id=”site-logo”>
$simplecatch_headerdetails .= '<div id="site-logo">
but bing webmaster report yet two h1 tag.
You want me to put my entire code to control it?March 14, 2014 at 2:52 pm #21336telexespositoMemberVery well, now it works! He had to upgrade the system to see the changes.
Thank you!
-
AuthorPosts
- The topic ‘Two H1 tag..’ is closed to new replies.