So my question is I need to add a link to a image and header in my wordpress site. Now I have tried to just add it next to it but nothing happens. It is using Custom Field Plugin.
Here is what the code looks like
<div class="calloutboxes">
<h2><?php echo $cbox['title']; ?></h2>
<img src="<?php echo $cbox['image']['sizes']['gallery_large'] ?>" height="<?php echo $cbox['image']['sizes']['gallery_large-height'] ?>" width="<?php echo $cbox['image']['sizes']['gallery_large-width'] ?>" alt="<?php echo $cbox['title']; ?>" />
<p>
<?php echo $cbox['description']; ?>
</p>
<a title="Read more about <?php echo $cbox['title']; ?>" href="<?php echo $cbox['read_more_url']; ?>"><i></i>Read More</a>
</div>
<?php endforeach;?>
</div>
</div>
Thanks
Related
Im trying to obtain an H2 header for class "aawp-product__title"
<div class="aawp-product__content">
<a class="aawp-product__title" href="<?php echo $this->get_product_url(); ?>" title="<?php echo $this->get_product_link_title(); ?>" rel="nofollow" target="_blank">
<?php echo $this->get_product_title(); ?>
</a>
<div class="aawp-product__description">
<?php echo $this->get_product_description(); ?>
</div>
</div>
Thanks
I don't know what You actually want to achieve but this should be working good for You
<a class="aawp-product__title" href="<?php echo $this->get_product_url(); ?>" title="<?php echo $this->get_product_link_title(); ?>" rel="nofollow" target="_blank">
<h2><?php echo $this->get_product_title(); ?></h2>
</a>
Semantically, which is more correct: a in h2, or h2 in a?
Thanks, what I need is the aawp-product__title echo which returns a product title to be and H2 or H3 header.
I have three separate fields in acf one for each image named slide_one, slide_two and slide_three. Now when I try to get the images to display using the code below nothing is being output. I am doing it this why and not using a loop like you usually as I'm wanting to have a separate text overlay for each image that I will have sliding in separately. This is the first step and it won't work. What an I doing wrong?
<div class="slider">
<ul class="slides">
<?php
$image_one = get_field('slide_one');
if( !empty($image_one ): ?>
<li>
<img src="<?php echo $image_one['url']; ?>" alt="<?php echo $image_one['alt']; ?>" />
</li>
<?php endif; ?>
<?php
$image_two = get_field('slide_two');
if( !empty($image_two ): ?>
<li>
<img src="<?php echo $image_two['url']; ?>" alt="<?php echo $image_two['alt']; ?>" />
</li>
<?php endif; ?>
<?php
$image_three = get_field('slide_three');
if( !empty($image_three ): ?>
<li>
<img src="<?php echo $image_three['url']; ?>" alt="<?php echo $image_three['alt']; ?>" />
</li>
<?php endif; ?>
</ul>
</div>
I'm trying to redirect the header logo to a specific URL as well. I came across this site during my research. Please take a look at the following code and let me know exactly what modifications needs to be made to accomplish this. Thanks in advance.
<h1 class="<?php echo $class; ?>">
<a href="<?php echo esc_url(home_url('/')); ?>" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?>" rel="home">
<?php echo $logo; ?>
</a>
</h1>
Thanks,
Jon
Remove <?php echo esc_url(home_url('/')); ?> and replace it with your URL like so:
<h1 class="<?php echo $class; ?>">
<a href="https://example.net" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?>" rel="home">
<?php echo $logo; ?>
</a>
</h1>
Very short question but it seems like i'm just to dumb.
<div class="header-content" id="header-content">
<div class="container">
<div id="logo">
<a href="<?php echo home_url(); ?>" title="<?php bloginfo('name'); ?>">
<?php
if(isset($theme_options['logo']) && isset($theme_options['logo']['url']) && $theme_options['logo']['url'] != ''){
echo '<img src="'.$theme_options['logo']['url'].'" alt="" />';
}
else{
echo '<img src="'.get_template_directory_uri().'/assets/img/placeholder/logo.png" alt="" />';
}
?>
</a>
</div>
Since there is only just one "href" in it i thought i could change this line:
<a href="<?php echo home_url(); ?>" title="<?php bloginfo('name'); ?>">
Into:
<a href="http://example.com/" title="<?php bloginfo('name'); ?>">
But after a cache clear and reload nothing changed. In case you didnt figured out what i try, its simple. I want to change the link the blog logo is leading to without changing the blog home url.
I have the below code in a page.
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
<div class="listing-type-list catalog-listing top10full" onclick='window.open("http://google.com")'>
<?php
$i = 0;
foreach ($_productCollection as $_product):
$i++;
?>
<div class="listing-number"><p class="listing-position"><?php echo $i ?></p></div>
<div class="listing-item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
<?php // Product Image ?>
<div class="product-image">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getSmallImageLabel()) ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
</a>
</div>
I would like to replace http://google.com with the product url:
<?php echo $_product->getProductUrl() ?>
However the above way of getting the product url only works when inside the foreach loop.
How can I get this to work?
Which product do you want to use to replace http://google.com? There is one link and many products.
You can try to use first one <?php $pr = $_productCollection[0]; echo $pr->getProductUrl() ?>