Create a post with REST API and adding a category

Solution was simple. Set DOM element value in JS variable instead of “document.getElementById(‘post_category’).value” in array. var submitBtn = document.getElementById(‘submit-post-btn’); submitBtn.addEventListener(‘click’, function(){ var categoryTerm = document.getElementById(‘post_category’).value; var postData = { “title”: document.getElementById(‘post_title’).value, “content”: document.getElementById(‘post_content’).value, “status”: ‘publish’, “categories”: [categoryTerm] } };

Ajax load more inside custom post type taxonomy

Assuming the function hooked to the action load_posts_by_ajax is your load_posts_by_ajax_callback() code (seems a reasonable assumption), the query arguments can be easily modified. You mention “displays only 3 posts” which is what the code is designed to do. If you wish to show 10 posts, update the posts_per_page argument listed. ‘posts_per_page’ => ‘3’, The bigger … Read more

Create secondary Archive page format?

You could copy the contents of your current archive page file into a new file, then tweak the functionality there into what you need it to do. At the top of the file, give it a template name like this: /* Template Name: Short Archive */ Now you can create a new page and select … Read more

Ajax by worpdress affects called jquery inside template file

This will not work: function widget_data(){ include get_template_directory() . ‘/inc/wid/card/widget-card.php’; wp_die(); } The include statment includes the “widget-card.php” only into the file and not the output stream. You have to redirect the output into a variable and then output the value via “echo”. function widget_data(){ ob_start(); include get_template_directory() . ‘/inc/wid/card/widget-card.php’; $output = ob_get_clean( ); echo … Read more