Custom Post Type and Blocks

Posted in: Newspaper
Post count: 85

I have a custom post type that I use for displaying info about staff members of my company. But for some reason in Newspaper 6, I can’t get the template for my CPT and blocks to display correctly. I basically created a single template with code based of a page template and sidebar right. But for some reason any block in my post doesn’t display correctly.

See here: http://i61.tinypic.com/4h341i.jpg

And if it helps, this is the code I am using for the single template: http://pastebin.com/kQpZd2S3

Any idea how to fix this?

Post count: 1291

Hi,

Please check if the CPT single page uses your custom made template, it may load something else. Unfortunately i cannot provide a quick solution for this, you have to check how the single and loop-single templates are built and start from there. Some elements have to be changed or modified, check which one is useful – http://screencast.com/t/whzCbKBkZtvz – An alternative would be to look for a professional developer to help you with this, if you don’t know any you could look for one on places like – http://studio.envato.com/

Thank you!

Post count: 85

I’m positive it is using my custom template. The problem seems to be inside the content when the_content() is called. The block ends up having a class of td-block-span4 instead of td-block-span6 like on other pages.

Post count: 1291

Hi,

The blocks receive a parameter which tells them on how many columns to be rendered – http://screencast.com/t/lgj9izPrU

Please paste a link so we could take a look, maybe we can provide some clues.

Thank you!

Post count: 85

Link: http://staging55.gfqnetwork.com/people/andrew-zarian/

The block is SHOWS and I am using block 3.

Post count: 1291

Hi,

Try to add the following condition inside block 3 file – http://screencast.com/t/467HrszVpnb

if (is_page_template('single-people.php') and $td_column_number == 3){
   $td_column_number = 2;
}

If it doesn’t work try this one:

if (is_single() and $td_column_number == 3){
   $td_column_number = 2;
}

It checks if the template file is single-people.php and it sets the columns variable to 2.
Let me know if it helps.

Thank you!

  • This reply was modified 11 years by Emil G.
Post count: 85

I got it to work thanks! I modified the code slightly though as the check for the specific template didn’t work but the code below does.

if (is_singular('people') and $td_column_number == 3){
$td_column_number = 2;
}

Post count: 85

I think I’ve run into another bug with blocks and custom post types. The columns for each post in a block do not appear to be rendered correctly, especially if there are more than 3. I end up with posts that aren’t displayed correctly.

http://i62.tinypic.com/w6xq0z.jpg

I am using a custom block, but I also tested the custom block on an actual page, and do not have this problem. I looked at the DOM structure, and as far as I can tell, the DOM structure is the same as a page, except for the body class. As one would expect, the body class for a custom post type is ‘single.’ Could it be that the because the body class is ‘single’ rather than ‘page’ it is causing this issue?

Post count: 1291

Hi,

It seems to be a css issue, i suspect a cleafix. If you can’t find it please provide the url so i can take a look.

Thank you!

Post count: 85

Hi,

The URL for the page is: http://staging55.gfqnetwork.com/people/andrew-zarian/

I’m not sure where to even look.

Post count: 1291

Hi,

The problem is in the code, you set the block (on 2 columns) to generate 5 modules/row – http://screencast.com/t/hFJqiSnI5d

I’ve used custom css to change the default 33.3% width to 20% to clear this out.
Here’s an explanation on how the code works – http://screencast.com/t/8u1x8Vki3
Hope this helps.

Thank you!

  • This reply was modified 11 years by Emil G.
Viewing 11 posts - 1 through 11 (of 11 total)
The forum ‘Newspaper’ is closed to new topics and replies.