Skip Navigation

[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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 11 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von guyA-2 vor 6 Jahren, 2 Monaten.

Assistiert von: Shane.

Author
Artikel
#1112786

I have two sites with exactly the same code base:

We're using:

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.

#1113052

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Guy,

Could you send me a screenshot of the area that the view is being displayed?

Thanks,
Shane

#1114123

Morning Shane,

I hope you had a good weekend.

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!

#1114527

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Guy,

I tried connecting to the site's ftp to check on the template but its not working.

Could you check on this and let me know?

Thanks,
Shane

#1114869

Here are the correct SFTP details.

I've tested these and confirm that they work:

#1115205

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Guy,

Still no luck.

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.

Thanks,
Shane

#1115453

Hi Shane,

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.

Thanks for your support.

#1115780

Hey Shane,

I notice our staging server login details are in the public domain. Can you please remove these asap?
Thanks!

#1115848

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Guy,

Tried again and still no results.

Could you send me the archive php file for both sites so that I can have a look ? This way that we can progress forward on this if even a little.

Thanks,
Shane

#1116177

Here you go:

<?php get_header(); ?>
<header class="header">
<h1 class="entry-title">Workshops</h1>
</header>
<section id="content" role="main">
<section class="main-column">

<?php

$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(); ?>

#1116371

Hi Shane,

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.

#1116456

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?