Skip Navigation

[Résolu] Archive into View into Layout into a page

This support ticket is created Il y a 7 années et 4 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: Asia/Kolkata (GMT+05:30)

Marqué : 

This topic contains 13 réponses, has 2 voix.

Last updated by Ole Andreas Vekve Il y a 7 années et 4 mois.

Assisted by: Minesh.

Auteur
Publications
#462687

I have an Archive (hidden link). These results should be visible in another page or page template (hidden link).

I have tried solving the problem by doing the following:

  • Made an Archive, which can be found here: hidden link
  • Made a View, which will display the custom post type Ansatte (This is correct)
  • Made a Layout, which displays the View (This is correct. In Edit Layout I can see the different posts appears)
  • Saving this, and heading back to the page template to check if everything is correct.

Page Template

<div class="clearfix">
	<div class="holder">
		<h1>Våre ansatte</h1>
		<?php the_ddlayout( 'default-layout' ); ?>
	</div>
</div>

I have also changed

<?php the_ddlayout( 'default-layout' ); ?>

into the layout slug

<?php the_ddlayout( 'ansatte-for-ansatte-siden' ); ?>

But does not change the output.

This is what is being showed: hidden link

An infinity loop of the page, and nothing from the post types.

This is the whole page template:

<?php
/*
Template Name: Om oss
*/

register_taxonomy_for_object_type('post_tag', 'page');
get_header(); ?>

<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'toppbilde', 'mal' ); ?>

<article>
<div class="clearfix">
	<div class="holder color1 whitetext centertext">
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<h1 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h1>
					<div>
						<?php 
							// Fetch post content
							$content = get_post_field( 'post_content', get_the_ID() );

							$content = apply_filters('the_content', $content);

							// Get content parts
							$content_parts = get_extended( $content );

							// Output part before <!--more--> tag
							echo $content_parts['main'];
						?> 
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="clearfix">
	<div class="holder white color1text">
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<div>
						<?php echo $content_parts['extended']; ?>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="clearfix">
	<div class="holder">
		<h1>Våre ansatte</h1>
		<?php the_ddlayout( 'default-layout' ); ?>
	</div>
</div>
</article>

<?php include 'sporsmal.php'; ?>

<?php endwhile; // end of the loop. ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

The question is also related to showing the items / posts on the index page.

#462837

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

So the first thing here is could you please try to place the "the_ddlayout" call outside the while loop code and check what is displaying and at least you get correct resutls.

<?php while ( have_posts() ) : the_post(); ?>

<?php endwhile;?>
#462853

Thank you for helping me out.

I placed it outside the loop, and it shows nothing... hidden link

#462875

On the front page the regular wordpress posts are being shown: hidden link

#463053

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can I have access details of your site so that I can debug it further.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#463158

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I debugged your issue and found that you did not added anything to your view cell's "Loop Output Editor".
=> hidden link

I've added post title with link to it and its perfectly displaying.
=> hidden link

Could you please confirm?

#463179

Thank you very much, that solves that problem.

But how about the index page? Should I make a new question for that? I thought it was the same problem, but it turns out it isn't.

The post type Tjenester is going to be shown at index, but currently only the regular wordpress posts are beeing shown there. I have set up a layout with layout slug which should solve this problem. But it does not work... hidden link

Could you please take a look?

Looking forward to hear from you again,

#463194

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

You did not assigned the layout to your home/blog page thats the reason it was not displaying the Tjenester entries.

I hope now all OK.

#463994

Thank you,

That solves the problem.

Took only a short look at it, turns out the problem is not solved anyways.

#463996

Hi again,

Turns out I was wrong. There are two different archives that are going to be listed on the front page.

1. hidden link
2. hidden link

Both of them are different post types, and I thought I set it up correctly in the index.php-file by using:

<?php the_ddlayout( 'tjenester-index' ); ?>

And the following:

<?php the_ddlayout( 'prosjekter-index' ); ?> 

However, on the front page the same archive is being loaded twice. Instead of loading two different ones.

How do I solve this problem?

#464410

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can’t do this trick with Views Archive cells using two layouts calls which is actually wrong. Views Archives and Views Archives cells are meant to correspond exactly to one single archive corresponding to the resource requested with $wp_query->queried_object because WP set a $queried_object at a time that might be a post a page and archive or category.

So what you should do is add one layouts archive cell and add another view cell to same layout to display your another post type content.

So solution would be for your layout:

<?php the_ddlayout( 'tjenester-index' ); ?>

You should add one archive cell to dispaly tjenester content and add another view cell to display prosjekter content.

#464488

Thank you, that explains it.

However, I scanned my view cell, and I get the error: This View is not used anywhere yet.

This is within the layout Tjenester - Index, which is the same as

<?php the_ddlayout( 'tjenester-index' ); ?>

I have added the view cell as you said, but there is something that I'm missing.

Do you have any ideas what?

Looking forward to hear from you again,

#464512

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - you need to add whatever you would like to display to "Loop Output Editor" section of the view cell you just added.

Could you please add content to display with your loop output editor?

#464522

Thank you,

I thought that came automaticly when added from an existing cell.

Problem solved.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.