• Resolved carm8568

    (@carm8568)


    I recently used the codex directions to resize the header in Twenty Eleven. The header image resized to 980 x 120 just fine but now the blog title and description text cannot be hidden.

    The website is https://www.carmenamato.net.

    Here is all the current header code from the functions.php file

    Thanks in advance!

    $custom_header_support = array(
    		// The default header text color.
    		'default-text-color' => '000',
    		// The height and width of our custom header.
    		'width' => apply_filters( 'twentyeleven_header_image_width', 1000 ),
    		'height' => apply_filters( 'twentyeleven_header_image_height', 288 ),
    		// Support flexible heights.
    		'flex-height' => true,
    		// Random image rotation by default.
    		'random-default' => true,
    		// Callback for styling the header.
    		'wp-head-callback' => 'twentyeleven_header_style',
    		// Callback for styling the header preview in the admin.
    		'admin-head-callback' => 'twentyeleven_admin_header_style',
    		// Callback used to display the header preview in the admin.
    		'admin-preview-callback' => 'twentyeleven_admin_header_image',
    	);
    
    	$args = array(
    	'width'         => 980,
    	'height'        => 120,
    	'default-image' => get_template_directory_uri() . '/images/header.jpg',
    	);
    	add_theme_support( 'custom-header', $args );
    
    	if ( ! function_exists( 'get_custom_header' ) ) {
    		// This is all for compatibility with versions of WordPress prior to 3.4.
    		define( 'HEADER_TEXTCOLOR', $custom_header_support['default-text-color'] );
    		define( 'HEADER_IMAGE', '' );
    		define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
    		define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
    		add_custom_image_header( $custom_header_support['wp-head-callback'], $custom_header_support['admin-head-callback'], $custom_header_support['admin-preview-callback'] );
    		add_custom_background();
    	}
Viewing 15 replies - 1 through 15 (of 18 total)
  • mar1965

    (@mar1965)

    Hi Carmen,

    So you would like to hide “Author Carmen Amato” and “Finding Connections Across Cultures”?

    Assuming you have a child theme, you can add the following CSS to your styles.css:

    #site-title {
        display: none;
    }
    
    #site-description {
        display: none;
    }

    or try code below better for SEO

    #site-title {
        position: absolute;
        top: -9999px;
        left: -9999px; }
    
    #site-description {
        position: absolute;
        top: -9999px;
        left: -9999px; }
    mar1965

    (@mar1965)

    Ravalde, I totally get your point. That is an excellent tip!

    Thread Starter carm8568

    (@carm8568)

    Thanks but am not sure if ravelde’s code would replace or be in addition to what is there now in the site-title area:

    #branding {
    	border-top: 2px solid #bbb;
    	padding-bottom: 10px;
    	position: relative;
    	z-index: 9999;
    }
    #site-title {
    	margin-right: 270px;
    	padding: 3.65625em 0 0;
    }
    #site-title a {
    	color: #111;
    	font-size: 30px;
    	font-weight: bold;
    	line-height: 36px;
    	text-decoration: none;
    }
    #site-title a:hover,
    #site-title a:focus,
    #site-title a:active {
    	color: #1982d1;
    }
    #site-description {
    	color: #7a7a7a;
    	font-size: 14px;
    	margin: 0 270px 3.65625em 0;

    Also, there is no cild theme and being a rookie, don’t understand how to make a child theme. The wordpress directions are not clear enough and I don’t know how to create a new a properly formatted style.css file. I can copy the Twenty Eleven style.css file but then what do I do with it.

    Last thing–sorry to sound needy but I have had a problem with images transferring to Facebook as well and no one has responded to my queries on that. Waht thread shuld that query be in? Many thanks.

    WPyogi

    (@wpyogi)

    Sorry but not using a child theme is a BIG mistake and will cause you major problems down the road.

    If you can edit the header file, you can figure out the child theme.

    WPyogi

    (@wpyogi)

    You simply use a text editor on your local computer to create exactly what is in the Codex directions. Then use FTP to upload that file to the new child theme folder — which must be on the same level a the parent file.

    mar1965

    (@mar1965)

    Hi Carmen,

    You have probably gone through the directions in this article Example of a basic Child Theme, but to break it down for you, once you’ve created the new folder for your child theme within the wp-content/themes directory, and have gotten the following code in the new properly formatted style.css file,

    /*
    Theme Name: Twentyeleven Child
    Description: Child theme for the twentyeleven theme
    Author: Your name here
    Template: twentyeleven
    */
    
    @import url("../twentyeleven/style.css");
    
    #site-title a {
        color: #009900;
    }

    saved it, and then uploaded it to the new folder you created for your child theme, you would need to activate the theme from the dashboard. Once it is activated, you would go to Appearance -> Editor in order to see the newly created style.css. From there, you can add the code that Ravalde shared directly below the last CSS style in the child theme’s style.css.

    Thread Starter carm8568

    (@carm8568)

    Sorry, here’s what I don’t understand–how exactly do I make a .css file? I can go to my hosting site and create a folder. But I don’t know what program I’m using to make a .css file. I know how to make a .doc file but am assuming I don’t use Word for this. Thanks again.

    Thread Starter carm8568

    (@carm8568)

    I followed the directions and now have a child theme listed in my FTP directory. But on the Themes section of my wordpress dashboard it says the theme has no stylesheet and cannot be activated.

    I pasted the current Twentyeleven stylesheet into a new file and uploaded that but it did not allow the theme to be activated.

    WPyogi

    (@wpyogi)

    No, you cannot just copy the current stylesheet. You need a new file that you create using a text editor on your local computer. A text editor is a program (similar to Word) that creates and edits text but does not add any formatting (which Word does). Most operating systems have a text editor built-in or you can download a free one. The new EMPTY file needs to have the text that is posted above by mar1965 in it. Then when you have that done, use FTP and upload it into the new child theme folder that otherwise empty. Then try again to activate the child theme.

    mar1965

    (@mar1965)

    Hi Carmen,

    The fact that you now have a child theme listed in your FTP directory is a great start. As WPyogi suggests, you have to create a separate style.css file using a text editor in order to activate the child theme. I’ve repasted the css which already includes Ravalde’s search engine optimized way of hiding the blog title and description directly below.

    /*
    Theme Name: Twentyeleven Child
    Description: Child theme for the twentyeleven theme
    Author: Your name here
    Template: twentyeleven
    */
    
    @import url("../twentyeleven/style.css");
    
    #site-title a {
        color: #009900;
    }
    
    #site-title {
        position: absolute;
        top: -9999px;
        left: -9999px; }
    
    #site-description {
        position: absolute;
        top: -9999px;
        left: -9999px; }

    You can copy and paste the above code into a blank text file, edit the author information and save that as style.css and upload it to the child theme’s directory.

    Best of luck!

    Thread Starter carm8568

    (@carm8568)

    OK, copied the code posted above by mar1965 into a .txt file using Notepad and uploaded it to the new folder for the child theme within the themes directory. That is the only thing in the folder.

    On my wp dashboard it still says that the child theme has no template or stylesheet and cannot be activated.

    The codex sure makes this sound easier than it is! Thanks again for the help.

    mar1965

    (@mar1965)

    Hi Carmen,

    Sorry, I meant to say that prior to uploading the file, you have to save it as style.css. It is not being recognized by the child theme in the dashboard because you have uploaded it as .txt. You can even rename it directly on your server account control panel. See if that works.

    Martin

    WPyogi

    (@wpyogi)

    Per the comment above that using negative margins is better than display: none; — not really true according to Google’s guidelines:

    https://support.google.com/webmasters/bin/answer.py?hl=en&answer=66353

    Thread Starter carm8568

    (@carm8568)

    OK, thanks for the tip. I renamed the file from the FTP control panel and it allowed the child theme to become “live” on my wp themes dashboard. Then I edited the style.css file to add the code to eliminate the title/description. Thank to all for helping a rookie!

    #site-title {
        display: none;
    }
    
    #site-description {
        display: none;
    }
Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Unable to hide title in Twenty Eleven header’ is closed to new replies.