• Resolved cmeister

    (@cmeister)


    Hi All,

    PHP rookie here….

    For my Duena theme there is customization in the Dashboard for a title and site description on the home page.

    The title, in my case. is a person’s name. I want to target the last name only and stylize it in “Style.css“. If I was working with an HTML file, I would add a <span> tag and class.

    It looks like I need to modify the “Header.php” code in some way to target the name. The code does not distinguish between first and last name.

    Code below:

    <div class="container clearfix">
    			<div class="logo">
    			<?php if (( of_get_option('logo_type') == 'image_logo') && ( of_get_option('logo_url') != '')) { ?>
    					<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo esc_url( of_get_option('logo_url') ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"></a>
    			<?php } else { ?>
    				<?php if ( is_front_page() || is_home() || is_404() ) { ?>
    
    					<h1 class="text-logo"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    				<?php } else { ?>
    					<h2 class="text-logo"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h2>
    				<?php } ?>
    			<?php } ?>
    				<p class="site-description"><?php bloginfo( 'description' ); ?></p>
    			</div>
    			<?php if ( of_get_option('g_search_box_id') == 'yes') { ?>

    Hope you can help!

    Thanks,

    cmeister

Viewing 9 replies - 1 through 9 (of 9 total)
  • You are correct that adding a span and class around the last name would do the trick. And as you can see, the Site Title is not being output with raw content, but PHP instead. So here’s what you can do…

    Create a child theme if you haven’t already and copy the header.php file to the root of your child theme. As you’ve already noticed, the code outputting the Site Title is:

    <?php bloginfo( 'name' ); ?>

    You can remove that and simply hard code your site title in place. Take note that the above code appears twice because of the SEO considerations. So replace it in both places. Then with your pure HTML in place, you can span and class it up however you’d like!

    To make sure the title/logo functionality continues to work as the theme intended, be sure not to edit anything else unless you know exactly what you’re doing.

    Hope this helps!

    Thread Starter cmeister

    (@cmeister)

    sdavis2702,

    Thanks.

    You mentioned pure HTML. Do I have access to HTML at all?

    This WP install is hosted (not by WP).

    Which HTML file would I be editing, and where is it located?

    Thanks,

    cm

    Is this a wordpress.com site or a self-hosted WordPress install?

    Thread Starter cmeister

    (@cmeister)

    It’s self-hosted.

    In that case, you do have access to the HTML in the theme’s template files via Appearance -> Editor but do not edit any of them. Instead, create a child theme for your changes.

    Thread Starter cmeister

    (@cmeister)

    Or I can use the Jetpack CSS plug-in? Is that correct?

    Only your CSS changes.

    Thread Starter cmeister

    (@cmeister)

    Thanks for all the help.

    Thread Starter cmeister

    (@cmeister)

    Resolved.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Theme: Duena] Target a Word in Header with PHP’ is closed to new replies.