Help Please - want to move h3 from here to here

Help Please - want to move h3 from here to here:

I have this code, so the word “City” become h3,

<li>
<img src="<?php echo get_bloginfo('template_url'); ?>/images/location.png" width="15" height="15" /> 
<h3><?php _e("City", "WordPressTheme");?>:</h3>
<p><?php echo $location; ?></p> 
</li>

I would like to make the location h3, I have tried code modifications, yet not working ;(

<li>
<img src="<?php echo get_bloginfo('template_url'); ?>/images/location.png" width="15" height="15" /> 
<h3><?php _e("City", "WordPressTheme");?>:</h3> (h3 remove)
<p><?php echo $location; ?></p> (h3 added to this line)
</li>

all help appreciated :slight_smile:

Hi,

I’m not quite sure what the question is :slight_smile:

If for example you are looking to create an output that says:

Location : London

Then surely it would be easier to output it like that.

e.g.


<h3><span><?php echo $location; ?></span> : <?php _e("City", "WordPressTheme");?></h3>

If you are tied to the code that you already have and you can’t change the html order then you can’t really move the display of those elements other than absolutely positioning them into place which would be awkward. You could add padding left to the h3 and then absolutely position the p element into that spot but would be a little fragile unless you can adjust the html structure and if you can adjust the html then there would be no need to do it that way anyway :).

Hello Paul, thank you for your reply to my not well explained post,


<h3><?php _e("City", "WordPressTheme");?>:</h3>

(h3 remove)

<p><?php echo $location; ?></p>  
                              (h3 added to this line)

Currently the word “City” becomes h3

 <h3><?php _e("City", "WordPressTheme");?>:</h3>

this is of no Seo value,

I tried replacing the h3 with a p, but no that upset my page layout

<p><?php _e("City", "WordPressTheme");?>:</p>

Then I wanted to add h3 to this line

<p><?php echo $location; ?></p>

the location has SEO value

<p><?php echo $location; ?></p>

I tried this

 <h3><?php echo $location; ?></h3>

but no that upset my page layout

I hope that explains how I am wanting to change those 2 lines of code,

:slight_smile:

Hi, I almost have it correct here, but not 100%, now the “City” does not align correctly on the page,

<li>
<img src="<?php echo get_bloginfo('template_url'); ?>/images/location.png" width="15" height="15" alt="houses for rent" /> 
<p><?php _e("City", "WordPressTheme");?>:
<h3><span><?php echo $location; ?></p></span></h3>
</li>

Hi Ray,

The html you are showing above is invalid because you have nested the closing p tag in the wrong place.

It needs to be:


<li>
<img src="<?php echo get_bloginfo('template_url'); ?>/images/location.png" width="15" height="15" alt="houses for rent" /> 
<p><?php _e("City", "WordPressTheme");?>:</p>
<h3><span><?php echo $location; ?></span></h3>
</li>

Don’t confuse html elements with appearance. CSS handles the appearance so you can change the look of all tags. You may need to add classes to those elements and then you can style them as needs be. I still think the first suggestion I made is more semantic because it groups the necessary information into the h3. ‘City’ is not a p tag and makes more sense when merged with the town.

Hi Paul, thank you for your reply, and code fix,

I was wanting/hoping/trying to change the h3 from one line to the next with out having to make CSS changes,

You can see the page here: house-for-sale-by-owner dot com

You will see how the City is now not bold, and the city name has jumped to the right,

I will attempt to correct the CSS now :slight_smile:

Hi Paul, ok code changed, css changed, and all looking great :slight_smile:

Now the valuable word have a h3 status for seo purposes :slight_smile:

I want to add a alt=“my words” for the bullet-cat.png to this code, tried placing the alt, but no not correct,

your help appreciated :slight_smile:

$mese .= '<ul>';
$link = get_term_link($term->slug,"ad_cat");
$mese .= "<li class='top-mark'> <a href='#' class='parent_taxe active_plus' rel='taxe_project_cat_".$term->term_id."' ><img rel='img_taxe_project_cat_".$term->term_id."'
src=\\"".get_bloginfo('template_url')."/images/bullet-cat.png\\" border='0' width=\\"9\\" height=\\"12\\" /></a> 
<h3><a href='".$link."'>" . $term->name; 

That doesn’t look like css to me :slight_smile: but wouldn’t you just add it in the same format as you have.

e.g.


alt=\\"my words\\"

You don’t need border=“0” in the image because that is deprecated and you can handle that in your stylesheet reset with:


a img {border:none} 

Hello Paul, Perfect! just the code I needed :slight_smile: Thank you very much for all your help :slight_smile: With your help I have tidied up code, changed css and added alts to images.

Thank you and best wishes :slight_smile: