New answers tagged content
You can use get_post_field() for getting the post fields i.e. Title, Content etc. // Replace $post_id with the ID of your post/page <?php get_post_field( post_title, $post_id); get_post_field( post_content, $post_id); ?>
The WordPress doesn't operate with concept of partial content. The content of the post is seen as single block of text/markup, possibly with embedded external elements. Even in latter case that is considered one way flow — content output will process embeds, but embeds aren't meant to be extracted from content. In your case I would guess the data ...
If you are needing users to have the ability to edit/delete their submitted content I would assume they are registered with their own member account on your wordpress website. If this is the case, why not build a custom role for your new members and then restrict everything for that role in the WP-admin to only show the posts add and edit page? This would be ...
Another approach: ob_start(); the_content(); $content = ob_get_clean();
the_content() prints it output to screen. What you want is to return that output and assign a variable to it. You should note, although get_the_content() do exactly what you want, it only returns unfiltered content, and not filtered content like the_content(). You should manually add those filters, which is real easy. You can do the following $content = ...
Kim is correct. get_the_content() displays your intended result. <?php $content = get_the_content(); printf("Output: %1$s", $content); ?>
You want to use get_the_content(), the_content() prints the content. get_the_content() will be assigned to your variable.
I believe your best solution will be to setup postdata and the making use of the the_content() template tag $post = get_page_by_title( 'About us' ); setup_postdata( $post ); ?> <p> <?php the_content(); ?> </p> <?php wp_reset_postdata(); ?>
You must separate the template file who you want Like get_template_part('file_without_php');
I would recommend installing the Advanced Custom Fields plugin in order to achieve the desired functionality. Once you download it, create a few fields. For example, create a field called "footer_text" and print it like this: <?php the_field('footer_text'); ?> and so on with the rest of the fields.
Top 50 recent answers are included