Jump to content

Pull Page Content's Styling onto Category Template


nvrsmr
 Share

Recommended Posts

Hi. 

I’m hoping someone can help me pull the styling/formatting from a static page onto a category template.  The content is pulling fine, but it's not formatted/styled.

Code used to pull content from static page onto custom category template:

<?php $page = get_page_by_title( 'page-name' );
$content = apply_filters('the_content', $page->post_content);  
echo $content; ?>

With the above code, the content is being pulled, but the formatting and styling is not being pulled.

The following code is adapted to pull the styling/formatting:

<?php $page = get_page_by_title( 'Wedding Venues in Costa Rica' );
$content = apply_filters('the_content', $page->post_content); 
echo do_blocks( $content );>


It did not pull the styling/formatting.

We’re using GeneratePress Pro + Generate Blocks (no page builder).  The static page is built with Gutenberg and GenerateBlocks.

By the way, I'mm not a coder or a developer.  I know a little about this and about that, but this isn't my field of expertise.  

Could someone please suggest what can be done to this code to get it to pull the styling form the static page onto the custom category template?

Thank you very much.

Link to comment
Share on other sites

Perhaps you are not getting a response because it is unclear what your terminology means. When you say the formatting and styling is not being pulled, yet the content is, makes no sense, at least to me. Are you saying you CSS is not being pulled? Did you echo $page and $content to make sure it is what you expect? Do they contain valid CSS data and the proper tags? Is error reporting turned on?

Link to comment
Share on other sites

Hello,

Thanks for responding.  

Please keep in mind I am not a coder or developer.  Much of what I've done is by searching online for tutorials and with the help the support forum at GeneratePress.  I've been out of work for five months due to the current situation with the virus, and can't afford to pay someone for help.  Sorry. 

These are the URLs for the pages in question


Static Page (Source of Content & Formatting):  https://wordpress-424710-1336702.cloudwaysapps.com/venues/

Category Page (Target): https://wordpress-424710-1336702.cloudwaysapps.com/costa-rica-wedding-venues/

 

As you can see, the content is pulled onto the category page, but does not have the same not formatting.  I guess that means the CSS isn't being pulled from the source static page to the target custom category page.

My apologies.  I don't know what you mean by: "Did you echo $page and $content to make sure it is what you expect? Do they contain valid CSS data and the proper tags? Is error reporting turned on?"  

Are you suggesting I do something to the code below in order to report what is being pulled from the static page?  I can enable error reporting on the sever.  I don't think it currently is. 

<?php $page = get_page_by_title( 'Wedding Venues in Costa Rica' );
$content = apply_filters('the_content', $page->post_content); 
echo do_blocks( $content );>

 

Have I sufficiently clarified my terminology and goal?  If not, please let me know what's lacking clarity.  

Again, thank you for your response. 

Link to comment
Share on other sites

Hello gw1500se,

 

You really don't have to be a d&%k.  I'm not asking for free coding.  I've presented the code I'm using and asking if there is an issue with it with regards to it not doing what it's supposed to do.  Had I posted that I wanted to do X and asked someone to give me al the code, then you would be right, but that's not what I did.  I see people on this forum all the time asking for someone to check out their code, which is what I did.  Were they coders, then why did they ask for the same type of help I'm asking for?

If you're not going to help, keep your personal comments to yourself. 

Have a great day!

Edited by nvrsmr
Link to comment
Share on other sites

That is not how you presented your OP and I'm sorry you took my meaning the wrong way. However, that does not mean you will succeed if you don't understand the basics. That being said you need to post your code here not make people go to a 3rd party site. If you don't even know what it means to echo variables how can you expect us to help? You need to post the problematic code here and its context along with any errors or what you are getting compared to what you expect. This forum has all the tools to post whatever you want to show.

Link to comment
Share on other sites

That's exactly how I present it.  I stated: here's what I want to do, here's what I'm doing, here's the issue, and there's the code used for this specific function.  

I did not make anyone go to a third-party site.  There are no URLs in my post. Maybe you should have read and fully understood my first post before commenting.  In my second post, I included URL because you stated I was not sufficiently clear in my first message, so I sent you URLs for clarity, to show you what was going on on the front end.

 

I did not take your meaning the wrong way.  I took it exactly as you meant it.  If you're not going to help, then bugger off.  I neither want nor need, nor have the time for you sophomoric attitude.  I presented a case exactly as do most other people in this forum who are having an issue with code.  That I am not a coder or developer is irrelevant.  I asked for help with code in the same way most others do.  

 

Have a good day.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.