WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] I am facing an unusual problem with alt title. (15 posts)

  1. praveen68
    Member
    Posted 2 years ago #

    Hi!

    I am designing a site for my friend on wordpress. I am facing this problem with index page post.
    I have added 2 sticky post using query. Now the title alt is getting displayed.
    Please check the link
    http://www.praveensworld.org/phoenixventures/

    I am new to wordpress, so, if I have overlooked something really silly bear with me.

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    this is caused by an image tag without full information;

    how it looks in the html in the browser:

    <div class="post-item">
    							<img src="http://www.praveensworld.org/phoenixventures/" alt="How Training is important for Development">
    							<h2> <a href="http://www.praveensworld.org/phoenixventures/?p=49"> How Training is important for Development </a></h2>

    what is the code of that section in your template?

    use the pastebin.com for any code over 10 lines

  3. praveen68
    Member
    Posted 2 years ago #

    This is the link to pastebin.com

    http://pastebin.com/D6mEw47z

    Just in case.. Here is the code.

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <div class="post-item"><img src="<?php $thumb = get_post_custom_values('post-image'); echo bloginfo('url') . '/' . $thumb[0]; ?>" alt="<?php the_title(); ?>" />
    <h2> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h2>
    <p class="meta"> posted by <?php the_author();?> on <?php the_date(); ?> </p>
    <?php the_content('read more...'); ?>
  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    have you filled the custom field 'post-image' for these posts?

    should contain the image url relative to the site url.
    does the theme have instructions about using this?
    or is this your code?

    if you don't want/need an image above the post titles, remove this line:

    <img src="<?php $thumb = get_post_custom_values('post-image'); echo bloginfo('url') . '/' . $thumb[0]; ?>" alt="<?php the_title(); ?>" />

    you need to fix the existing line - but this does not seem to be the main cause of the problem - you still need the right information in the custom fields:

    <div class="post-item"><img src="<?php $thumb = get_post_custom_values('post-image'); echo get_bloginfo('url') . '/' . $thumb[0]; ?>" alt="<?php the_title_attribute(); ?>" />

    the changes are:

    use get_bloginfo() when you echo it as a string - http://codex.wordpress.org/Function_Reference/get_bloginfo

    use the_title_attribute() - http://codex.wordpress.org/Function_Reference/the_title_attribute

  5. praveen68
    Member
    Posted 2 years ago #

    Thank you alchymyth.
    This is my code and the theme is my own design. As suggested, I removed the first line and the alt error got fixed. But, my website top margin shifted below as can be noticed in the link given below.

    http://www.praveensworld.org/phoenixventures/

    Unfortunately, of all the browsers, only firefox displays so. I don't want it so as I love firefox. :-((

  6. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    my website top margin shifted below

    I m not sure what you refer to - maybe you need to post a screenshot.

    if you mean the top margin above those posts where the alt text was, possibly reduce the top margin in here:

    #content .post-item {
    	margin-left: 12px;
    	padding-left:13px;
    	margin-right:12px;
    	margin-bottom:20px;
    	margin-top:20px;
    	padding-bottom:20px;
    	border: 1px dashed;
    	border-bottom-style: dashed;
    	border-bottom-color: #grey;
    	position:relative;
    }
  7. eridout
    Member
    Posted 2 years ago #

    Maybe that's a mistake in your header banner?
    I see "Enuring Your Business Success".
    Perhaps there's an S missing if you meant "Ensuring Your Business Success"
    but alternatively "Assuring" might be a better choice.

  8. praveen68
    Member
    Posted 2 years ago #

    @alchymyth

    The link below is the screenshot.

    http://www.praveensworld.org/1.jpg

    It shows up only in firefox.

    @eridout Nice suggestion.

  9. jeevank
    Member
    Posted 2 years ago #

    Hello There,

    If I am getting correct you are using custom field to set a second image. Well i do have two solutions for this issue:

    1. You are missing $post->ID as second argument of get_post_custom_values('post-image', $post->ID). so your thumbs array contains nothing for its index 0. Please read http://codex.wordpress.org/Function_Reference/get_post_custom_values

    2. You can use mutiple_post_thumbnail plugin to add secondary image to you post. Activate this plugin register your thumbnail in your funstions.php and upload secondary image as you do fo featured image of any wordpress post.

    please follow this link: http://wordpress.org/extend/plugins/multiple-post-thumbnails/

    Go 224 line of your style sheet and add this rule to your #bottombody division css properties.

    overflow:hidden;

    meanes:

    #bottombody {
    background-image: url("images/bottombg.gif");
    background-repeat: repeat-y;
    height: 1100px;
    overflow: hidden;
    text-align: left;
    width: 900px;
    }

    Hope it will solve your inner page css issue.

    --jeevank

  10. praveen68
    Member
    Posted 2 years ago #

    @jeevank. Thanks for your suggestion. I have downloaded the plugin and will use it soon.
    I gave overflow: hidden; yet it renders same in firefox only. In IE, safari and chrome it is perfect. I was expecting IE to play pranks. ;-)
    Is it something to do with float absolute I gave to
    .post-item img {
    margin: 0px 20px 30px 10px;
    padding: 4px;
    border: 1px solid #a8a8a8;
    float: right;
    position:absolute;
    top: -30px;
    right:-165px;
    }
    I have spent 2 days on it. Yet to come up with a solution. :-((

  11. gizmofreak
    Member
    Posted 2 years ago #

    If I am getting correct you are using custom field to set a second image. Well I do have two solutions for this issue:

    1. You are missing $post->ID as second argument of get_post_custom_values('post-image', $post->ID). so your thumbs array contains nothing for its index 0. Please read http://codex.wordpress.org/Function_Reference/get_post_custom_values

    2. You can use mutiple_post_thumbnail plugin to add secondary image to you post. Activate this plugin register your thumbnail in your funstions.php and upload secondary image as you do fo featured image of any wordpress post.

    Please follow this link: http://wordpress.org/extend/plugins/multiple-post-thumbnails/

  12. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    the space at the top might be caused by the admin bar (?)

    - try to logout and see if the space is still there;
    - try to change the settings: untick dashboard - settings - users - your profile - Toolbar [ ] Show Toolbar when viewing site
    - check if your theme has <?php wp_footer(); ?> in footer.php in the line before </body>

  13. praveen68
    Member
    Posted 2 years ago #

    Wow! Thank you alchymyth. Now it is ok. It was the toolbar space.

    My theme doesn't have <?php wp_footer(); ?> in footer.php

    Thank you all for the help.

  14. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    My theme doesn't have <?php wp_footer(); ?> in footer.php

    then add it - this is quite important if you want to use plugins; this is where plugins add scripts etc.

    http://codex.wordpress.org/Function_Reference/wp_footer

  15. praveen68
    Member
    Posted 2 years ago #

    I added it to footer alchymyth. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic