On my website I have to pages, Events and News. Both have the same format and styling. Using ACF, is there a way to add ‘posts’ to either the Events or News pages from the admin panel?
My News(and Events) pages look like this:
https://drive.google.com/open?id=0B9gJ3yRm64DrZGRPenlZNE9tbUk
My HTML for both pages is as follows:
<h2>
<a href="#">News Post Title</a>
</h2>
<p class="lead">
by <a href="index.php">User</a>
<i class="fa fa-clock-o"></i> Posted on August 28, 2013 at 10:00 PM
<hr>
<a href="blog-post.html">
<img class="img-responsive img-hover" src="http://placehold.it/900x300" alt="">
</a>
<hr>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolore, veritatis, tempora, necessitatibus inventore nisi quam quia repellat ut tempore laborum possimus eum dicta id animi corrupti debitis ipsum officiis rerum.
<a class="btn btn-primary" href="#">Read More <i class="fa fa-angle-right"></i></a>
Is this possible?
Hi @movingsale
You should be able to do it by using the post object field. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/post-object/.
But, a better solution would be creating custom post types for both news and events, and then query them on each template. To add the custom post type, you can use https://wordpress.org/plugins/custom-post-type-ui/. To learn how to query custom post types, please check this page: https://codex.wordpress.org/Post_Types#Querying_by_Post_Type.
I hope this helps 🙂