[Gelöst] View in PHP template dislpays entire content of single custom post
This support ticket is created vor 6 Jahren, 2 Monaten. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
BTW I'm getting some really weird result when I use:
$args = array(
'title' => 'Workshops Archive View','myattribute' => 'myvalue');
echo render_view( $args );
?>
in our custom php template. Where "Workshops Archive View" is my view.
On versteckter Link the template works fine
but on our other staging site: versteckter Link the exact same code prints out the entire contents of each single custom post and then displays the content template underneath it.
I've even checked PHP versions and flushed the permalinks but can't get to the bottom of this.
And the php templates are identical.
Sorry my bad there was some password protection in place on one of these sites.
You should be able to see both pages in my message below to compare:
If you go to this page: versteckter Link You'll see that the entire content of our custom post is being displayed above our content template starting with the white box with the image in it.
If you go to this page: versteckter Link you'll see how this should be working. The full text of the custom post is not being displayed only the content template that we've set up.
Both sites are using identical archive-workshops.php templates and the view settings and content templates are the same.
I can't for the life of me figure out why these two pages are behaving differently!
Can you make it so that my user account can modify the theme files through the backend instead? I noticed that I was not able to access the wordpress default code editor for the theme.
This should be a suitable workaround for me to check the theme file.
Sorry my bad again. I have a cold at the moment so I'm not on top of my game.
The correct username is: kobolwil there was a l missing from the end!
BTW you are already set as a WP admin on this site so I'm not sure what I need to change in order to allow you to change pages in what you call the 'default code editor'. Can you let me know what you need me to do in order to enable this for you?
Otherwise those SFTP details should work now.
We're hoping to get this site live tomorrow.
So it would be great to get this sorted asap.
$args = array(
'title' => 'Workshops Archive View', // This is the view that is embedded in the PHP template - but it's outputting the entire post content and then the content from the content template. I'm using exactly the same on another site.
'myattribute' => 'myvalue');
echo render_view( $args );
?>
<?php get_template_part( 'nav', 'below' ); ?>
</section><!--close main column -->
<?php get_sidebar('workshops'); ?>
</section><!-- close #content -->
<?php get_footer(); ?>
I'm still struggling with this issue on this site.
I've managed to isolate the problem a little. It seems to lie in the content template.
I deleted all the content in the content template and the archive page displays all the post content even without anything in the Workshop Content Template.
When I put my code back into the content template it adds this to the bottom of the post content.
How could my Workshops Archive View be outputting the content of single posts even with nothing in it's content template?
We're not even using the WP loop on this PHP template?
I've tried deleting both the view and the content template but get the same result.
I'm baffled by this as we have the exact same set-up (views, php template and content template) on our showcase site and it works fine.
Hey Shane, I kept digging into this and was able to fix the issue by embedding the content of the content template in the view itself. When we embed the content template in the view that's when it breaks.
Even if I recreate the content template from scratch and try and add to a view it breaks.
So we can't use content templates in views on this site. I'm not sure why - perhaps it's a corrupt database but we need to move on and get this site delivered.
Has this come up before? Do you know if there's a way to round this in future?