how to format custom fields?

My services have been retained to finish up a project using the Directory plugin and CustomPress.

We need to format the output field by field, beyond the choices provided in the plugin of table, list, or div.

The site had 2 scripts in the default theme of the directory plugin:


It appears that the only way I can format the custom field output is to modify one of your plugin's core files now which is core.php. That *feels* spooky to me because it will put my client at risk of not being able to update the plugin in the future.

Why aren't we able to influence output using the custom scripts that were in play before the most recent update?

  • 3SixtyEvolve

    Hi virtuallymarj

    Greetings from the WPMU DEV Support Team and thank you for being a member!

    I understand exactly what you're saying - going into the core php files is definitely not good from an upgrading point of view. I will get the Developer in on this thread to see if he can offer any advice or suggestion on how you can avoid this.

    That being said, with CustomPres you should be able to create custom fields without going into core files. So there has to be a work around for you.

    Please allow us some time to get back to you. And in the meantime, if you require any further assistance, please don't hesitate to be in contact.

    Have a good day and all the best in setting up the Directory for your client.


  • virtuallymarj

    My client and I thought that what I wrote was pretty clear but I'll take another run at clarifying.

    Of course CSS is used for styling. The div that you refer to could be added to the style sheet and basic formatting coule be accomplished.

    What is spooky to me is that there are only 3 ways to output the custom fields using the UI and these are (1) Table, (2) Unordered List, or (3) Div.

    The custom fields themselves needed to be formatted (i.e., turn a text string into a link). With previous versions of the plugin, these custom fields were added to custom templates which are listed above. The only way to specify order and re-work output of custom fields now is to modify a core plugin file.

    Do you see the problem that this will introduce for future upgrades?

  • Arnold

    Bear with me because I've only been on this plugin for about a week.

    If you go into CustomPress where the Custom fields were created go to the Custom Fields tab and under the title of each Field Name is a link that displays a Embed code. Looks something like

    <?php echo get_post_meta( $post->ID, '_ct_text_4f5f5812e3ef8', true ); ?>

    Depending on the field type. That's what you would embed in a template. Since it's in PHP you can add your own code around it to manipulate it most anyway you want

     $title = get_post_meta( $post->ID, '_ct_text_4f5f5812e3ef8', true );
    echo ucword($title); // Upper case the first letter of each wordf

    You could even combine two or more embed codes so you could do combinations of fields.
    And you haven't touched the core.

    Closer to what you want?

  • virtuallymarj

    What you've written is all true, Arnold, and exactly the way that I'm doing it. The problem is that one used to be able to do JUST that in a template that was not a CORE file within the plugin. In my professional opinion, altering core code should not be required because it wasn't required before.

    GinaB understood the problem I was describing, as well as my concern. Let's just wait for one of the developers to come back, OK?

  • Arnold

    Sorry if I'm misunderstanding but since I'm the developer, I kinda need to know.:slight_smile:. I just inherited it about a week ago so I'm still learning what it's about.

    I understand not changing core files. What I haven't heard is what you need to do that would require changing core files? I'm tasked with straightening this project out so don't be shy about letting me know what you need but please be specific.

  • virtuallymarj


    I honestly thought that I had been clear.

    When I look at the code, it references scripts that are entitled single-listing.php and dr_listing.php. When I made changes to these files, nothing changed on the site. The formatting options available was to group all the custom fields declared via Custom Press at once as a table, an unordered list, or a div. Since we are entering text for links to the vendor fanpages and twitter accounts, we needed to format those text fields as links. We could not do that in single-listing.php. We could only do that by changing core.php.

  • fitoussi

    Hi virtuallymarj,
    I might not be very helpful but I kinda needed similar thing to do with my project and i went through different kind of issues after updating. However , now I am being able to modify both single-listing.php and dr_listinglist.php after copy them into my child theme and It is wierd that single-listing.php will not work for you . But you may want to try "loops/loop-page.php" if you are using the directory theme ( maybe page.php in other theme). that is what I found when i was running the issues. As much as I understand ( I might be wrong) the core.php just builds the code to be execute through a template file which again, I think is loop-page.php or may be loop-archive.

  • virtuallymarj

    I was brought into this project after several plugins had been cobbled together to build a site on a theme that had already been designed. Just as I preferred to make clothing from a patter over repairing a zipper, following someone else's work with so many "complicated" plugins as components to the task may have caused me to not totally study everything.

    But, that being said, the reason that I was brought into the project to begin with is because my client could NOT make the single-listing.php script take changes so something is definitely broken. The Directory plugin is pretty much lacking documentation, so far as I can see, too. That is not a criticism, merely an observation.

  • aecnu

    Greetings virtuallymarj,

    Just checking if this issue was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, happy days, glad you got it sorted :slight_smile:

    Thank you for being a WPMU Dev member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.