Integrating Custom Post Types to X Theme Widgets and Sliders and Other Parts (Complete Integration)

Hello,

Using Ethos stack on X Theme. Look at my site main page:

https://www.kirmiziperfect.com

Some of my custom post type archive pages (all posts in these pages are Custom Post Types):

https://www.kirmiziperfect.com/mount-blade-warband-mods/
https://www.kirmiziperfect.com/grim-dawn-mods/

There is an Ethos slider showing random posts and below also you can see random posts. The problem is this. All of these are from the “Posts”. I have many many “Custom Post Types” (and soon all regular Posts will be converted to the CPTs.)
How can i change the X theme that i can also show posts from CPTs on Slider and main page and on widgets?

Hey there.

First, to edit the type of posts that appear on your homepage, you would need to edit the main query to include these post types. WordPress by default only shows “posts”. There’s a write up here explaining: http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

For the Ethos post slider, you would need to copy a file from your parent theme into the child theme, keeping the same directory structure. That file is: /FRAMEWORK/VIEWS/ETHOS/_POST-SLIDER.PHP

in that file, you will see this line of code 3 times:
'post_type' => 'post',

You would need to change that to include the post types you desire:
'post_type' => array( 'post', 'page', 'album', 'movie', 'quote' ),

Hi michael,

Very helpful and easy! Thanks.

Another thing. Can i randomize the posts on main page?

You can, but it’s generally not recommended as the SQL query is inefficient. I wouldn’t.

Tell me I will try the performance impact.

Different topic but since i catch you i want to ask another thing too.

Set a bacground image in this page. (Image is 1920x1080) But it only appears under the heading “Titan Quest Anniversary Edition Mods”. Is there a way to cover all the page?

https://www.kirmiziperfect.com/titan-quest-anniversary-edition-mods/

Hello İlhan,

Thanks for updating in!

You can’t because by default WordPress will display the post items in chronological order. It maybe possible with custom function though.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

To make sure that the background image will display and get rid of the white background, please add the following CSS code in the X > Theme Options > Global CSS (http://prntscr.com/evui3r)

.page-id-88798 .x-container.main:before {
    background-color: transparent;
}

Hope this helps. Please let us know how it goes.

That worked perfectly. Thanks.
I will look for this custom function then.

You are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.