• Hello,
    This plugin was very useful for me to filter my posts because I have multiple custom taxonomies. I also have multiple custom fields in which i can specify “types” of info for each post. What i want to do is add a call for this custom fields instead of excrept in each post.

    I’ve been doing some research on the support forum and FAQ, and copied a hook to my functions page. The code that returns the title works, but I can’t find the way to get the specific information I want.

    Thank you in advance for any help

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author thehowarde

    (@thehowarde)

    Hello @juliape

    There is not enough information in your question to help you.

    To be clear, the support you seek is basic WordPress functionality with retrieving variables from a post rather than specific help with my plugin.

    Thread Starter juliape

    (@juliape)

    What i want to do is, for example, replace the default “date” or “author” with my custom fields “genre”, “format”, etc. In my theme i know how to call that info with get_field, but fail to write that correcly in the hooks that i’ve found here

    Plugin Author thehowarde

    (@thehowarde)

    you’re still not showing any code, so I can only assume.

    This should be documented in ACF for the second parameter in get_field.

    
    global $post;
    get_field('your_field', $post->ID);
    
    • This reply was modified 2 years, 10 months ago by thehowarde.
    Thread Starter juliape

    (@juliape)

    Thank you for your quick response, and I am sorry that I cannot communicate my issue clearly.
    I’ve coppied the following code from this answer

    add_action( 'dd-carousel-after-content' , 'my_custom_carousel_header' , 10, 1);
    function my_custom_carousel_header($id){
    	if ($id == 2267) { // your carousel ID - numeric
    	     global $post;
    	     echo '<a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a><br>';
                 $terms = get_the_terms($post->ID, 'product_cat'); // use your custom taxonomy
                 $term_list = array();
                 foreach ($terms as $term){
                     $term_list[] = $term->name;
                 }
            echo implode(', ', $term_list);
         }
    }

    This indeed showed the title of my post, so i thought that simply editing the code below would show the info i need, but can’t seem to find the way.
    I understand if this query is not relevant, sorry for any inconvenience

    Plugin Author thehowarde

    (@thehowarde)

    Hi

    What you posted here doesn’t show what you’re trying to get or how you’re trying to get it.

    Thread Starter juliape

    (@juliape)

    Hi, what i have so far is this:

    add_action( 'dd-carousel-after-content' , 'my_custom_carousel_header' , 10, 1);
    function my_custom_carousel_header($id){
    	if ($id == 11253) { // your carousel ID - numeric
    	     global $post;
    			echo '<p>'.get_field('resumen', $post->ID).'</p>';
    	}
    }

    what i want to do is add more of my custom fields, but i’m having some issues.

    Also, i would need to set whatever i manage to add in this “new meta” in all my other carosusels, in which i’ve tried but failed with the following:

    add_action( 'dd-carousel-after-content' , 'my_custom_carousel_header' , 10, 1);
    function my_custom_carousel_header($id){
    	if (in_array($_GET['id'], array(11253, 10959))) { 
    			global $post;
    			echo '<p>'.get_field('resumen', $post->ID).'<p>';
    	}
    }
    Plugin Author thehowarde

    (@thehowarde)

    This

    if (in_array($_GET['id'], array(11253, 10959)))

    should probably be

    if (in_array($id, array(11253, 10959)))

    If you’re using the ID that is passed as the carousel ID.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display custom fields as content’ is closed to new replies.