Need a quick PHP Help

6 replies
I am using iblogpro theme by page line and i want to have a clickable button in the feature box rather than a simple. Here is the code

HTML Code:
</div>
                      <div class="ftext">
                     <?php echo do_shortcode($feature['text']);?>

<?php if($feature['link']):?>

 <a class="featurelink" href="<?php echo $feature['link'];?>">
                    
<?php _e('Click here to Win Free Droid Bionic',TDOMAIN);?></a>
                                                            <?php endif;?>
                                        </div>
How can i place a image in the feature box instead of the link?
#php #quick
  • Profile picture of the author carrot
    Just some css should do:

    .featurelink {display:block;width:100px;height:50px;background-image: url(images/button.jpg);text-indent:-999px;}

    Obviously you need to change the dimensions and image file, plus probably play around with margins and padding.
    {{ DiscussionBoard.errors[3385860].message }}
  • Profile picture of the author sulmaanaslam
    Hi Carrot,

    I placed the .css in theme stylesheet but it didn't workout :/
    {{ DiscussionBoard.errors[3386941].message }}
  • Profile picture of the author carrot
    There is probably already a rule for .featurelink in your css, you would need to edit/replace the existing rule.

    Without seeing the site (which i realize you might not want to show) i cant really be more specific.

    But the principle is there. You are just changing the way the link is styled.
    {{ DiscussionBoard.errors[3387046].message }}
  • Profile picture of the author womki
    The _e() function on wp is used for translation, so if you are going to use an image instead of text I guess you wont need it and you can replace it with anything you want (ie. an image).

    You would have to replace this part of the code:

    Code:
    <?php _e('Click here to Win Free Droid Bionic',TDOMAIN);?>
    with your image.
    {{ DiscussionBoard.errors[3387393].message }}
  • Profile picture of the author carrot
    ok, you need to edit line 69 of pro.css from this:

    .featurelink {
    background:transparent url(../../images/morearrow.gif) no-repeat scroll 100% 60%;
    padding-right:10px;
    }
    To this:
    .featurelink {
    background:transparent url(../../images/yourbutton.jpg) no-repeat center top;
    padding-right:10px;
    display:block;
    height:100px
    text-indent:-999px
    }
    Vhange the height property to your buttons height, and make sure your button is in the themes images folder
    {{ DiscussionBoard.errors[3387780].message }}
  • Profile picture of the author Emilis Strimaitis
    What about this:

    </div>
    <div class="ftext">
    <?php echo do_shortcode($feature['text']);?>

    <?php if($feature['link']):?>

    <a href="<?php echo $feature['link'];?>"><img src="your image"></a>

    <?php _e('Click here to Win Free Droid Bionic',TDOMAIN);?></a>
    <?php endif;?>
    </div>
    {{ DiscussionBoard.errors[3388585].message }}

Trending Topics