Link in php echo - php

How can I have a php echo that work as link.
I saw other answer on that theme but I can't achieve a working solution.
My script is:
<?php if(get_post_meta($post->ID,'website',true)):?>
<div class="info-inner">
<label><?php _e('Web:','colabsthemes');?></label>
<span><?php echo get_post_meta($post->ID,'website',true);?></span>
</div>

<?php
echo 'Link content';
?>
You add the rest.
Specify what do you want to achieve - link to a post with a specific id or what?

Thank you everyone for your intent to help me.
In the end I paid a professional who helped me with a very simple solution, which is:
<label><?php _e('Web:','colabsthemes');?></label>
<span><?php echo get_post_meta($post->ID,'website',true);?></span>

Related

PHP on dreamweaver showing up as all blue text as if error, but I cant figure out why

I have this piece of code that brings up a tooltip information text from my database. Its not working as it should, when I look on dreamweaver all the code is blue, where as the <?php is normally red. I've been looking at it for hours and cant see the reason, I know its probably something simple so would appreciate a fresh set of eyes on it.
Thanks in advance
<div class="covername-i"><img data-original-title= " <div class='covername-title-text'><?php echo $cover_arr->CoverName ; //echo $value->id; ?></div>
<?php echo $cover_arr->CoverNameText; ?>" data-placement="bottom" class="tootltiplink" src="<?php echo get_stylesheet_directory_uri(); ?>/images/info-icn-wht.png" class="cover-types-info" alt="<?php echo $cover_arr->CoverName ; ?> Explanation"/></div>

How can I display the value of a field in WordPress?PHP

I have this site:
link
I installed the plugin Types and tried this code to display the value field in a div.
<div class="selectat">
<div>
<?php $variable = do_shortcode("[types field='descriere' ]");?>
<?php echo $variable;?>
</div>
</div>
My field is called descriere..I put a picture to see more clearly.
Unfortunately this blank although I do not see anything on the site and basically my div is empty ..
It is wrong the way I wrote the code?
I must call another function?
You can help me solve this problem please?
Thanks in advance!
You dont need to use any shortcode you could use
<div class="selectat">
<div>
<?php $variable = the_field( 'descriere' );
<?php echo $variable;?>
</div>
</div>
But if you want to echo the code straight away you can just use get_field('') which echos the value straight to the page.
<div class="selectat">
<div>
<?php $variable = get_field( 'descriere' );
</div>
</div>

Add hreflang to magento language switcher

I am trying to add hreflang="ca-fr" or "ca-en" my code is below
<?php if ($_lang->getId() != $this->getCurrentStoreId()): ?>
<li class="language-<?php echo $this->htmlEscape($_lang->getCode()); ?>">
<a href="#" onclick="changeLang('<?php echo $_lang->getCurrentUrl() ?>')"
hreflang="<?php echo $this->htmlEscape($_lang->getCode()); ?>"
id="link-<?php echo $_lang->getId() ?>"><?php echo $frontendNameAssign[$_lang->getId()]; ?></a>
</li>
<?php endif; ?>
I added the 4th line to the file but this displays as "ca_us_english", is there a way to amend this?
I have also tried amending Miscellaneous Scripts with no joy, any help would be grateful.
thanks
Mel
Well in this case you are "right" and Magento is "wrong".
What Magento is actually presenting you as $_lang is not really the lang, but one of your store.
So ca_us_english is the code of your english candian store in your backend (you can have a look at it in the admin under System > Manage Stores)
To get the actual local set for this store you have to use this line of code :
Mage::getStoreConfig('general/locale/code', $_lang->getId())

Make a php a href link with variable clickable

i have a question.
I have this code to get an profile name as an link.
<a href=<?php echo $userpro->permalink( get_the_author_meta('ID') );
?>><?php echo $user_id=get_the_author_meta('display_name');?></a>
The link isnt clickable. I am a newbie in coding.
So maybe somebody can help me :)
Greetings
Try this:
<a href="<?php echo $userpro->permalink(get_the_author_meta('ID')); ?>">
<?php echo get_the_author_meta('display_name'); ?>
</a>
If it doesnt work... please supply the value and initialisation of $userpro!

Change PHP to a Link to a Page

I need to replace this get_option('mycruisine_menu_page_url') with a link to an actual page. Can anyone tell me what I need to change to do this? Thanks so much in advance. Apologies if I somehow didn't get the code to display properly. Edit: When I say actual page, I mean a link I can put in like http://www.mydomian.com/nursery.html.
<span><?php esc_html_e('Click Here To Find Out More!','MyCuisine'); ?></span>
<div id="bottom-shadow"></div>
</div> <!-- end .container -->
this:
<?php $my_link = "http://google.com/"; ?>
<span><?php esc_html_e('Click Here To Find Out More!','MyCuisine'); ?></span>
//or
<span><?php esc_html_e('Click Here To Find Out More!','MyCuisine'); ?></span>

Categories