Site logo

Archived topic

How to add content on Portfolio Archive Page that doesn't repeat

19 replies · Started by Lina on October 17, 2022

Viewing posts 1–15 of 20

I am trying to write a container of content on the Portfolio Archives Page that doesn't repeat for every single portfolio piece, which is what is happening now.

I'm obviously not adding it in the same container, so it can't be that.

I am trying to write a container of content on the Portfolio Archives Page that doesn’t repeat for every single portfolio piece, which is what is happening now.

Do you mean the text "Some samples are...."?

Where do you want it to appear?

Yes, that text.

I would like it to appear only once...like a sort of preamble, at the top, before all the portfolio thumbnails.
But whether I put it in a container, not a container... doesn't matter... it repeats for each thumbnail.

That's expected behavior if you add the text to the block element - content template.

You will need to create another block element, add the text, choose hook as element type and before_main_content as hook name, set the CPT archive as the location.

Ahhhh, thank you so much, I understand now. I've created another content template with a Hook, and it's working wonderfully.

One more question please: on the Portfolio Archive Page, this title of "ARCHIVES: PORTFOLIOS" appears. I don't want it there, but I don't know where it comes from. If you look at my Element for the Archives Content Template, that title doesn't even appear there. What am I missing?

Hi there,

you can use this PHP snippet to remove the Archive Title:


add_action('wp', function() {
	remove_action( 'generate_archive_title', 'generate_archive_title' );
});

Hi, David.

Here's the thing: that works perfectly, but it seems to also remove the content I was trying to put on that page in the first place.

Hmmm Not sure how to get around that. I put the PHP code in a code snippet, and when I inactivate it, content appears. When I activate it again, content disappears.

You can see the two screenshots below.

Oh, wait! The content is appearing... it's just that it's underneath the Portfolio thumbnails :)
I mean literally, underneath. Layered under them.

Is it possible to see the page ?

For sure

Nice :) The element you're using to Hook in the title and description. Can you change its Hook to before_main_content or after_header

Currently where its hooked in is inside the columns container and the masonry script don't like it :)

Hi David,

The plot thickens.

It was set on before_main_content before.

Now I've changed it to after_header. It works on my desktop, but on any browser I've tried on my phone, the text still appears underneath the Portfolio thumbnails.

If I change it back to before_main_content, the text goes back to appearing underneath the Portfolio Thumbnails, both on desktop and mobile.

No, I was mistaken. What's happening on mobile is that it doesn't even register any changes I make on the hook page. I tried changing some text on that page, and it appears on desktop, but not mobile.

I feel like I've fallen in the rabbit-hole in Wonderland :) I'm totally lost on this one.

Can you try clearing the browser caches on the mobile device.
If it still shows the incorrect result, clear any plugin caches, and connect to a different network on the mobile ( in case the Router or ISP is caching )

Okay David, I've tried all of this. I even installed a couple of brand new browsers on my phone.

I went next door and tried a friend's phone and ipad as well, both on wifi and on cellular data, and the same thing happens.

I put a dash after the last word on the content, and I can clearly see that that dash appears on desktop, but not mobile. Really weird.

This archived topic is closed to new replies.