Displaying Blog Posts on Forum
Quote from tala on December 22, 2017, 5:31 pmHello, i know there is an option to do that but i need more specific option. Let’s say i posted a new blog post and it’s in category A. I want to show only this post in Forum Subject A. Is it possible to do?
Thanks..
Hello, i know there is an option to do that but i need more specific option. Let’s say i posted a new blog post and it’s in category A. I want to show only this post in Forum Subject A. Is it possible to do?
Thanks..
Quote from Asgaros on December 22, 2017, 8:16 pmHello tala,
if you have coding-experience this should be possible with custom-code and theĀ transition_post_status hook. By default this is not possible because there are no options for this available yet.
Hello tala,
if you have coding-experience this should be possible with custom-code and theĀ transition_post_status hook. By default this is not possible because there are no options for this available yet.
Quote from tala on December 22, 2017, 9:11 pmWell i can do the code thing but where should i put this? I mean which template. That is not what i know. Anyway this could be a good option for the plugin.
Well i can do the code thing but where should i put this? I mean which template. That is not what i know. Anyway this could be a good option for the plugin.
Quote from Asgaros on December 23, 2017, 9:42 amYou have to put the custom code into your themes functions.php. For example it could look like this:
public function createBlogTopic($new_status, $old_status, $post) { if ($post->post_type == 'post' && $new_status == 'publish' && $old_status != 'publish') { // Add logic to figure out post category. // Set a forum ID based on category. $forumID = 123; $post_title = apply_filters('asgarosforum_filter_automatic_topic_title', $post->post_title, $post); $post_content = apply_filters('asgarosforum_filter_automatic_topic_content', $post->post_content, $post); if (AsgarosForumContent::forumExists($forumID)) { AsgarosForumContent::insertTopic($forumID, $post_title, $post_content); } } }
You have to put the custom code into your themes functions.php. For example it could look like this:
public function createBlogTopic($new_status, $old_status, $post) { if ($post->post_type == 'post' && $new_status == 'publish' && $old_status != 'publish') { // Add logic to figure out post category. // Set a forum ID based on category. $forumID = 123; $post_title = apply_filters('asgarosforum_filter_automatic_topic_title', $post->post_title, $post); $post_content = apply_filters('asgarosforum_filter_automatic_topic_content', $post->post_content, $post); if (AsgarosForumContent::forumExists($forumID)) { AsgarosForumContent::insertTopic($forumID, $post_title, $post_content); } } }
Quote from tala on January 7, 2018, 4:20 pmThanks for the answer that was a great solution. Can i add category name like;
$post_category->category_name == 'Guides'
Thanks for the answer that was a great solution. Can i add category name like;
$post_category->category_name == 'Guides'