• Resolved mattgcn

    (@mattgcn)


    Hello! I am trying to configure the plugin to pull from a custom field used by the Powerpress podcasting plugin with the id of “powerpress_episode_title_podcast”. I can’t seem to figure it out. Is use of fields created outside of Advanced Custom Fields supported? Using the and seems to just generate a blank space even if the field is in use which makes me think it’s not being called correctly

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    First, is that the correct name of the custom field? You should be able to pull the value of any custom field as long as you have the name right. That looks a little suspect to me, given that most plug-ins define custom fields using a leading underscore, so I’d have expected that field to be _powerpress_episode_title_podcast.

    Thread Starter mattgcn

    (@mattgcn)

    That could very well be the case! I was trying to figure out how to pull the name of the custom field and got that from the ID on the post page, but I will try it with the leading underscore and report back.

    Thanks!

    Thread Starter mattgcn

    (@mattgcn)

    Hmmm that doesn’t seem to be it either. Using the double square brackets yields a blank space still with the leading underscore. I suppose this comes down to not knowing the best way to find how a plugin’s custom field is defined, but I can’t seem to find that with a cursory Google.

    Thread Starter mattgcn

    (@mattgcn)

    Looking closer at the field in phpMyAdmin, it seems that the field is contained… within the “enclosure” field. This is what the value of the field is for an example podcast episode:

    https://futuresushi.agrius.feralhosting.com/wordpress/wp-content/uploads/elitefullrestore/EliteFullRestore-Episode001-RotomPokedexIsMySon.mp3
    80065514
    audio/mpeg
    a:4:{s:8:"duration";s:8:"00:51:26";s:13:"episode_title";s:24:"Rotom Pokédex Is My Son";s:10:"episode_no";s:1:"1";s:8:"category";s:1:"2";}

    The value I’m looking for in this case is the episode title as listed shortly after “episode_title” is placed in the bottom of the code there.

    Plugin Author Joe Dolson

    (@joedolson)

    That’s a serialized array value, then, which makes it a bit harder to get out – you can’t get it directly, so you’ll need to write some extra PHP to access it.

    Here’s an example showing you how you can manipulate the output of custom template shortcodes: https://github.com/joedolson/plugin-extensions/blob/master/wp-to-twitter/custom-field-content.php

    You’d need to access the array to get the title field, e.g.

    $value = get_post_meta( $post_ID, 'name_of_custom_field', true );
    $title = $value['episode_title'];

    There’s probably a function in your podcasting plug-in to fetch this value, but I don’t know what it is.

    Thread Starter mattgcn

    (@mattgcn)

    Hmm I will try to ask the Powerpress devs how to do that but I don’t have my hopes up. At the very least, I have the information now to realize this problem is not within the scope of your plugin and I can continue my support elsewhere (unless you happen to know how to structure the PHP call because I’m at a loss so far).

    Thank you so much for your help and patience with someone not too tech-savvy, it’s greatly appreciated! ??

    Thread Starter mattgcn

    (@mattgcn)

    So far working with the function there as you gave it, $value[‘episode_title’] fails to read the intended value correct, defaults to a value of “0” and outputs h (the first character in the URL string, the first part of enclosure) by default. If you would know how I could search to find useful results on how to get values out of an array it would be a huge help!

    Thread Starter mattgcn

    (@mattgcn)

    I followed the guide and extracted the value using substring searches. And it worked! So thank you so much!!

    The only thing I need now is to pretty up the links but the PRO service has too many features I won’t use to go for it just now :X if you ever make a PRO-Lite that just adds Twitter cards I’d be a sure buyer

    • This reply was modified 5 years, 4 months ago by mattgcn.

    I think I will be facing similar challenges knowing the theme I’m using is based on custom posts and custom taxonomies that generates arrays input by users (had to comment to subscribe to notifications), I think the Pro version will be a wise investment

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Difficulty using a custom field’ is closed to new replies.