Pasted Custom Field code into Woo commerce template to display a Custom Field Link.
Code used is:
<a href="<?php the_field('datasheet',the_ID()); ?>" >Download File</a>
But in the front end it adds the Product ID into the url.
it ends up looking like this:
Download Datasheet
Any ideas?
<a href="<?php the_field('datasheet',the_ID()); ?>" >Download File</a>
<a href="<?php the_field('datasheet',the_ID()); ?>" >Download File</a>
The purpose of the_ID() is to display the post id, meaning it will echo it.
You want get_the_ID() here, which only returns the id, but does not directly output it.
Related
I am doing a photo gallery with php, and my main page is a gallery with all thumbnail images. If you click on any thumbnail, it will link to another page with the original size image (like google images does). I do that with an hyperlink that contains an image inside :
<a href='".$row['image']."' class='image' title='".$row['title']."'>"."<img src=".$row['thumb']." class='thumb'/> </a>
Then if the user is now in the redirected page showing the big image selected, how can I do it so that if the user clicks on top of the big size image then it will be redirected to the main page with all the thumbnails?
<a href="<?php echo $row['image'];?>"class='image' title="<?php echo $row['title'];?>">
<img src="<?php echo ['thumb'];?>" class='thumb'/>
</a>
If you are able to link to a detail page using <a href, why are you not able to do the same from the detail page?
considering you are on listing page, say listing.php and images are listed from database. You can loop through the images as given below.
<a href="detail-image.php?id=<?php echo $image_from_database['id'];?>" class='image' title="image title">
<img src="<?php echo $image_from_database['thumb'];?>" class='large'/>
</a>
So, on clicking you will be redirected to detail-image.php where you can get the id using PHP $_GET/$_REQUEST
and then fetch the big image from database and show it. There you can do same to link to the listing page
<a href="listing.php" class='image' title="image title">
<img src="<?php echo $image_from_database['large_image'];?>" class='thumb'/>
</a>
Look I don't know exactly what's the problem,
but I think there wrong in your code,
must be like it,
<a href="<?php echo $row['image'];?>"class='image' title="<?php echo $row['title'];?>">
<img src="<?php echo ['thumb'];?>" class='thumb'/>
</a>
!! The page must be "Something.php"
I need to change the text of the checkout button which is viewed once hovered on the cart if any product is their in the cart, I need to rename it as Order Now instead of Checkout.
Please do suggest me the answer...
Below is the link to the image...
Click here to view the screenshot
Since you want to update Checkout word to Order Now ONLY in the Header Cart => Mini Cart, do the following:
Assuming you are using the RWD theme, navigate to app/design/frontend/rwd/default/template/checkout/cart/minicart/items.phtml
Line no: 94 & 95 From:
<a title="<?php echo $this->quoteEscape($this->__('Checkout')) ?>" class="button checkout-button" href="<?php echo $this->getCheckoutUrl() ?>">
<?php echo $this->__('Checkout') ?>
</a>
Update to:
<a title="<?php echo $this->quoteEscape($this->__('Order Now')) ?>" class="button checkout-button" href="<?php echo $this->getCheckoutUrl() ?>">
<?php echo $this->__('Order Now') ?>
</a>
Screenshot:
Let me know if this helps.
Happy Coding...
you can simply locate the template of that block and change the text. You can locate the template by using template path hints under
system->configuration->developer and set show template path hints to yes
and than on front-end you will be able to see the template file path on browser and you can easily change the text than.
thanks and let me know if there is any issues.
You can change simply by admin go to this path
Admin->system->configuration->developer->( click )Translate Inline and yes in ' Enabled for Frontend' save config
Refres your frontend and change your text then submit
Solve your problem......
I cant seem to figure out the code for this. im currently in the functions.php of my child theme.
i'm trying to have an image link to the comments section of the post. I already have a button that links to the post itself.
the code looks like
<a href="<?php the_permalink(); #reply-title ?>">
<img src="http://trueidconference.com/wowministriesblogs/wp-content/images/JOINimg.png" alt="Mountain View" style="margin-left:12px;"></a>
when I try it, it just doesn't show up. if I use it shows up, but of course doesn't link to the post, then to the id.
I have tried different variations even using echo to get it to work.
But I just cant seem to figure out how to add #reply-title to whatever the current permalink is.
the reason it is in the functions.php is because i needed to add this link to the bottom of every post.
Try:
<a href="<?php echo get_the_permalink(); ?>#reply-title">
If I understand correct you need this:
<a href="<?php the_permalink(); ?>/#reply-title">
<img src="http://trueidconference.com/wowministriesblogs/wp-content/images/JOINimg.png" alt="Mountain View" style="margin-left:12px;">
</a>
I am linking a wordpress post by using the below code.
<a href="<?php echo get_permalink( 15 ); ?>"
Which renders as below
http://mydomainname.com/?p=15
But when the users click, it should open up on a specific location, so I have used a tag with the attribute name to show that area directly.
Below is my HTML code.
<a name="fi"></a>
So the rendered URL would be like the below.
http://mydomainname.com/?p=15#fi
When I manually type like the below, it opens up perfectly on the location that I want it to open, but I do not know how to make changes to <a href="<?php echo get_permalink( 15 ); ?>" to achieve what I am looking for.
Adding #fi after the php code will achieve this:
Some link
that will print out to http://mydomainname.com/?p=15#fi
i make custom field in wordpress and insert link there like www.google.com i get this custom field like this
<?php $episode=get_post_meta($post->ID, "download_link", true);
?>
<a class="more-linkk" href="<?php echo $episode ;?>" target="_blank"></a>
now it opens in url like this http://dramapk.net/movie/www.google.com i want it just open google.com so kindly guide me
<a class="more-linkk" href="<?php echo "http://".$episode ;?>" target="_blank"></a>
If your link doesn't start with the protocol (http:// or https://) the browser puts the domain name before, so your link is invalid.