Home › Forums › Pro Support › field of custom post type
- This topic has 9 replies, 3 voices, and was last updated 6 years, 9 months ago by
Thierry.
-
AuthorPosts
-
September 7, 2016 at 12:09 am #705
David
ParticipantHi Tom! Congratulations for your new plugin WP Show Posts … It’s amazing !!
This plugin, lightweight and generate are tools that work daily. Easy and intuitive for graphics designer like us who do not have much knowledge of programming designers.
I write because I have a problem and although I have been reading the support forum and I’ve tried many things I can not put a field on a custom post type to display with WP Show Posts.
I sent a picture for you to see what I want to do.
Can you help me with this? Thanks!
September 7, 2016 at 11:23 pm #715Tom
KeymasterHi there,
Glad you like the plugin!
How are you adding the custom fields? Are you using a plugin or manually creating the metaboxes? Or maybe using custom fields?
Something like this should make it work: https://wpshowposts.com/support/topic/custom-fields/#post-220
Let me know 🙂
September 8, 2016 at 12:02 am #717David
ParticipantHi Tom, a very nice picture with your baby!
I am using the Post Type Builder plugin.
I read the link you send me support, but something I’m doing wrong because it does not work.
Can you help me? Thank you
September 8, 2016 at 9:51 am #724Tom
KeymasterCan you show me the code you’re using?
September 9, 2016 at 12:56 am #731David
ParticipantHi Tom, the code:
[insert_php]
add_action( ‘wpsp_before_title’,’wpsp_add_custom_meta’ );
function wpsp_add_custom_meta()
{
$meta = get_post_meta( get_the_ID(), ‘ptb_module ptb_text ptb_text_1’, true );
if ( isset( $meta ) && ” !== $meta )
echo $meta;
}
[/insert_php]with plugin insert php.
September 9, 2016 at 8:50 am #733David
ParticipantHi Tom, I keep trying new things to make it work …
I installed Pluginception and I created a plugin with the code:
<?php / * Plugin Name: codigophpfechacurso Plugin URI: description: Version: Author: Author URI: License: License URI: * / add_action ('wpsp_before_title', 'wpsp_add_custom_meta'); wpsp_add_custom_meta function () { Â Â Â Â $ Meta = get_post_meta (get_the_ID (), 'ptb_module ptb_text ptb_text_1', true); Â Â Â Â if (isset ($ meta) && ''! == $ meta) Â Â Â Â Â Â Â Â echo $ goal; } ?>
But it does not work. Maybe I have an error in the code?
Thanks!
September 9, 2016 at 10:07 am #735Tom
KeymasterThis:
wpsp_add_custom_meta function ()
Should be:
function wpsp_add_custom_meta()
This doesn’t look right:
ptb_module ptb_text ptb_text_1
The value should be 1 unique ID.
$goal
isn’t defined anywhere, it would beecho $meta;
You might want to check with the Post Type Builder plugin on how to retrieve the settings you’re creating.
December 15, 2016 at 2:52 am #1249Thierry
Participanthello Tom,
I understand but what is the code for display the field “Relationship” ?
December 15, 2016 at 11:22 am #1258Tom
KeymasterTotally depends on how you set it up – the plugin you’re using to create custom fields should have examples of how to call them in your templates.
December 15, 2016 at 11:38 am #1261Thierry
Participantno problem for display a simple field with your snippet but for a relationship with link i don’t understand for the moment. i search
-
AuthorPosts
- You must be logged in to reply to this topic.