Skip Navigation

[Resolved] URL to display title

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 10 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 10 replies, has 2 voices.

Last updated by Caridad 10 years, 11 months ago.

Assisted by: Caridad.

Author
Posts
#96660
wp-types.jpg

Regarding the image, I am trying to display the website name and have it link to the website url, but am not sure how to do that. I tried doing:

<p><a href="<em><u>hidden link</u></em>;?php echo(types_render_field( "website-url", array( ) )); ?>"><?php echo(types_render_field( "website-name", array( ) )); ?></a></p>
#96940

Dear Vytenisk,

As far as I can see that code should work. Maybe you need to remove the http:// like this:

<p><a href="<?php echo(types_render_field( "website-url", array( ) )); ?>"><?php echo(types_render_field( "website-name", array( ) )); ?></a></p>

What is the result you are getting? Can you enable WP_DEBUG to see if you have error messages?

https://toolset.com/documentation/user-guides/debugging-types-and-views/

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#97150

This is what I get:

<em><u>hidden link</u></em>">My Portfolio
#97370

Dear VytenisK,

Its important to insert the code in the right context. In other words, if there is a php tag opened before the code, make sure its closed after. Can you show me a couple of lines before your code aswell to make sure? Also enable WP_DEBUG because it may give us some clues about what is happening.

https://toolset.com/documentation/user-guides/debugging-types-and-views/

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#97371

I'm on the page in question but console doesn't seem to flag any errors. Here is my code:

<div class="summary entry-summary">

		<h2>ABOUT THE SHOOT</h2>

			<div class="about-shoot">
				<?php
					/**
					 * woocommerce_single_product_summary hook
					 *
					 * @hooked woocommerce_template_single_title - 5
					 * @hooked woocommerce_template_single_price - 10
					 * @hooked woocommerce_template_single_excerpt - 20
					 * @hooked woocommerce_template_single_add_to_cart - 30
					 * @hooked woocommerce_template_single_meta - 40
					 * @hooked woocommerce_template_single_sharing - 50
					 */
					do_action( 'woocommerce_single_product_summary' ); 		/*		DESCRIPTION 	*/
				?>
			</div>

			<div class="more-info">
				<h3>MORE INFO</h3>

				<p>&raquo; <p><a href="<?php echo(types_render_field( "website-url", array( ) )); ?>"><?php echo(types_render_field( "website-name", array( ) )); ?></a></p>


				<p>&#171; Photos by </p>
			</div>

	</div><!-- .summary -->
#97463

Dear VytenisK,

I cant see anything wrong with that code. Can you provide the URL to check if its a CSS issue or something? I would also like to check the source code generated.

Thanks,
Caridad

#97465

hidden link

#97477

This is now what my HTML says:

<p>&raquo; <?php echo(types_render_field( "website-url", array("title"=>"") )); ?><?php echo(types_render_field( "website-name", array( ) )); ?></p>

And what my source reads:

<p>&raquo; <a href="www.vytweb.com" title="www.vytweb.com">www.vytweb.com</a>My Portfolio</p>
#97484

Ok, I understand now. When you render a URL field it is being rendered with the link and everything. You need to use the raw parameter to get only the URL like you need:

<p>" <a href="<em><u>hidden link</u></em>;?php echo(types_render_field( "website-url", array("raw"=>"true") )); ?>"><?php echo(types_render_field( "website-name", array( ) )); ?></a></p>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#97487

Awesome, that works! Thank you very much for helping me out. Could you explain in layman's terms exactly what raw = true does?

#97488

It displays the value of the field as it is stored in the database, with no formatting applied.

https://toolset.com/documentation/functions/#URL

Regards,
Caridad

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.