-
AuthorPosts
-
August 3, 2014 at 6:46 pm #77185
Hi,
I would like to add a custom post type feed in the homepage (NEWS). So my website will have the blog section and another page (HOME) with news.
How could I do it?? I didn’t find in the VC the way to add a block with a loop of the NEWS custom post type.
The structure would be:
——————————-
| Menu Header |
——————————-
| Revolution Slider |
| |
| |
——————————-
|Custom post feed |
——————————-Thanks,
August 4, 2014 at 2:54 am #77368Any Idea?
August 4, 2014 at 8:13 am #77463Hi There,
Thanks for writing in,
As far as I understand, you are using a third party plugin or custom coded script to have the “News” post type as this doesn’t come bundled with X and not a default feature of wordpress. There’s a “Recent Post” element on visual composer similar to what you are asking but this doesn’t support additional post type you created from a plugin or custom code.
The best thing you can do is to create a custom query loop for News post type in your child theme functions.php and add it as a shortocode and you can then add it on any page.
Something like this
function custom_loop_for_news() { ob_start(); query_posts( array( 'post_type' => 'news','order' => 'DESC', 'orderby' => 'date', 'posts_per_page'=> 4 ) ); if (have_posts()) : while (have_posts()) : the_post(); echo '<div class="post-entry">'; echo '<h2><a href="'.get_the_permalink().'">' . get_the_title() . '</a></h2>'; echo '<div class="entry-content">'. apply_filters('the_content',get_the_content('Read More')).'</div>'; echo '</div>'; endwhile; endif; wp_reset_query(); return ob_get_clean(); } add_shortcode( 'news-post-type', 'custom_loop_for_news' );
Then you can add this on your page
[news-post-type]
I hope that helps.
Cheers
August 4, 2014 at 8:58 pm #77861That’s what I need!
Thanks!
August 5, 2014 at 2:56 am #77979You’re welcome.
August 5, 2014 at 12:17 pm #78281Hello Again,
One more thing, the demo page of ethos shows different pages with different loops depending on the category.
I wonder if I could do this way instead of create a custom post type for the homepage. Could I create a category News for the Posts and then show this posts in homepage??
Home page = Posts category News
Blog page = Regular postsAnd Could I show News at homepage using masonry and posts at blog page in standard mode?
Thanks!!
D.August 5, 2014 at 9:14 pm #78611Hey there,
That is not possible. The blog page displays all categories and you can’t make a category page your home page.
Thank you for understanding.
September 17, 2014 at 9:56 am #106502Hello to all at X Theme
is there any way i could include a little widget on the front of the rev slider that would show the 2 latest posts from the main blog page?
my website url http://rsaacademyits.com/rsa-new/
thanks in advance
NavneetSeptember 17, 2014 at 10:09 am #106524Hi Navneet,
Thank you for writing in!
You can try using our [recent_posts] shortcode to achieve your desired results. You can find demos here: http://theme.co/x/demo/integrity/1/shortcodes/recent-posts
To add it to the revolution slider, simply create a new layer and add the shortcode as it is inside the layer text. e.g.
[recent_posts count="2"]
Hope this helps. 🙂
Thank you.
September 18, 2014 at 3:50 am #107057Yes it worked! thank you.
is there anyway i can edit the style of the how the posts look on the slider using CSS editor?
thanks
NavSeptember 18, 2014 at 4:07 am #107064Hi Nav,
Yes you can.
/* background color */ .rev_slider .x-recent-posts a { background: red; } /* title color */ .rev_slider .x-recent-posts .h-recent-posts { color:red !important; } /* date color */ .rev_slider .x-recent-posts .x-recent-posts-date { color: red; }
Hope that helps.
September 18, 2014 at 5:01 am #107095brilliant, thank you for your support!
September 18, 2014 at 5:28 am #107110You’re welcome Nav 🙂
September 18, 2014 at 8:03 am #107179Sorry, me again, is there any way i can create a rollover effect on the posts that appear on the slider, ive used
a:hover {
background-color: orange;
}but no luck!
September 18, 2014 at 8:51 am #107203Hi there,
Please add the following CSS code under Customize -> Custom -> CSS:
a.x-recent-post3.no-image:hover { background: orange; }
Hope it helps.
-
AuthorPosts