• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How To Add Custom Fields to Custom Page Template

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How To Add Custom Fields to Custom Page Template

This topic is: not resolved

Tagged: Custom fields, custom page templates, custom post types

  • This topic has 5 replies, 2 voices, and was last updated 12 years, 9 months ago by Michelle Waters.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • July 14, 2013 at 11:23 pm #50739
    Michelle Waters
    Participant

    I have created a custom page template called single-clients.php. It is pulling in a Custom Post Type called Client, which I setup in Custompress. This all seems to be working fine.

    My problem is that I am not proficient enough in PHP to be able to pull in my custom field types.

    Can you help?

    This is what I have in my template:

    <?php
    /**
      * @author Tech Geek Ministries
     */
     
    /*
    Template Name: Clients Page
    */
    
    /**
     * This removes the loop.
     * If you want to include the static page title and content,
     * remove or comment out this code.
     */
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    add_action( 'genesis_loop', 'tgm_custom_loop' );
    
    function tgm_custom_loop() {
     
    
                //WP Query Start
     
                $per_page = 9;
     
                $clients_args = array(
                    'post_type' => 'clients',
                    'posts_per_page' => $per_page,
                                    'paged' => get_query_var( 'paged' )
                );
                $clients = genesis_custom_loop( $clients_args );
    
    }
     
    /** Move Post Info */
    remove_action('genesis_before_post_content','genesis_post_info');
    remove_action('genesis_after_post_content','genesis_post_meta');
    
    genesis();

    And here is a php code for one of my custom fields:

    <?php echo do_shortcode('[ct id="_ct_datepicker_51e310a9c8a48" property="title | description | value"]'); ?>

    I'm not sure how to put the two of these together.


    Creatorpreneur Collab

    http://www.tgmsandbox.com
    July 15, 2013 at 3:41 am #50751
    Brad Dalton
    Participant

    Could you paste the PHP for your custom fields in Pastebin or Githib Gists and link to it from here please. Thanks

    You could do what is needed without using a custom page template and simply use your child themes functions.php file.

    I always test my code however in this case, i didn't because i don't have a custom post type setup for clients and don't have a custom template named single-clients.php created.

    You can easily change the hook position where you want to display your date picker.


    Tutorials for StudioPress Themes.

    July 15, 2013 at 9:24 am #50791
    Michelle Waters
    Participant

    I tried this code, but nothing showed up on my page. I checked both the clients page and a single post page with the client content, but the custom field did not appear.

    I also tried pasting in the code from Pastbin, but the forum software is stripping the HTML out.


    Creatorpreneur Collab

    July 15, 2013 at 11:23 am #50806
    Brad Dalton
    Participant

    Not sure what code you used to create the custom field. Did you use the native WordPress custom fields, code or a plugin to create the custom fields?

    The code snippets above are simply an example of how to execute shortcodes using the custom post the conditional and page template conditional. You wouldn't need a shortcode for a custom field if you use the correct code to create it.


    Tutorials for StudioPress Themes.

    July 15, 2013 at 11:49 am #50820
    Brad Dalton
    Participant

    Please try the second code snippet again and see if it works. I have changed it slightly.


    Tutorials for StudioPress Themes.

    July 15, 2013 at 12:21 pm #50833
    Michelle Waters
    Participant

    I am using custompress to create my CPTs.

    I added the single quotes around single-clients.php, and changed property="title | description | value" to property="value" and my first custom field type appeared. Yeah!!!

    Now my second quandary: Getting the rest of my custom fields for this CPT to appear...


    Creatorpreneur Collab

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble