Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6583199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:22:40+00:00 2026-05-25T16:22:40+00:00

I am editing a Custom Post Type template, and am using custom fields to

  • 0

I am editing a Custom Post Type template, and am using custom fields to enter info into a meta box to be included on the page, as well as include some static default text on all the pages.

I basically need to “chunk” together the post info in the_content along with the static text and some meta box info. Here’s what I want:

  • the_content
  • static text
  • meta box 1
  • more static text
  • meta box 2
  • end of the _content

I have plugins that add social buttons before the_content and a signature after the_content so I am trying to figure out how to get all my custom stuff sandwiched in between those.

If I just add the meta boxes i nthe template, they display outside of the_content and the plugins display in unwanted places.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:22:41+00:00Added an answer on May 25, 2026 at 4:22 pm

    I ended up figuring this out on my own. The solution: using functions.php and add_filter, I had to create a new function to create the default content, and it works great.

    here’s the general code for anyone interested:

    function custom_post_type_default_content($content) {
    global $post;
        if ($post->post_type == 'your-custom-post-type') {
        $content .= '<p> '. get_post_meta( $post->ID, "metabox-1-slug", true ).' 
        <br />
        <p> '. get_post_meta( $post->ID, "metabox-2-slug", true ).'</p>
        <p>YOUR TEXT HERE.</p>';
    }
    add_filter('the_content', 'custom_post_type_default_content', 0);
    

    Note that the zero just near the end controls placement. I have a social media plugin that has a priority of “1”, and to get the default content to appear above that I have to make this a priority of “0”.

    Also note the single apostrophes that open and close the code following $content .=

    You basically add whatever you want between those apostrophes, and in this case I am pulling metabox info which have their own apostrophes containing code. It gets confusing!

    In other words, your code should be $content .='YOUR CUSTOM CONTENT' and within those apostrophes, add your text, code, etc. The standalone metabox code is '. get_post_meta( $post->ID, "metabox-1-slug", true ).' which is nested inside where the YOUR CUSTOM CONTENT text is.

    I am basically explaining this to myself, as these were the things that tripped me up so figured would explain them in detail to help someone else like me. Or me when I have to go look this up again!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm editing a ListViewItem template and I'm trying to add a custom control to
I have text fields inside a custom view inside an NSOutlineView . Editing one
Sometimes when I'm editing page or control the .designer files stop being updated with
I'm having a serious problem with custom post types in Wordpress. I made a
I am editing a custom calendar application in flash. The purpose of this app
I have a custom DataGridViewCell with a user-control as its editing control. The cell
I have a custom control template which is set via the style property on
I'm editing the order grid by adding custom columns like this $this->addColumn('pagamenti', array( 'header'
how can i indent my CUSTOM CELL while editing, resizing or moving labels and
I have a custom controller that handles the editing of user passwords based off

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.