How can I convert a list of title-posts into a sequence of comma separated text? [closed]

If you want to keep them all within one outer <li>, you can use something like this. Instead of echoing them immediately, save them to an array, then loop through the array. <?php if ($autores->have_posts()): echo ‘<li>’; // create an empty array $autoresArray = array(); while($autores->have_posts()): $autores->the_post(); // save the link and name $autoreLink = … Read more

.htaccess and proxy settings for routing a decoupled REST API consuming theme

Ok this probably has a superfluous few lines but this works for me: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^static/(.*)$ /wp-content/themes/MYTHEME/static/$1 [R=301,NC,L] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

Standard technique for AJAX post endpoint: WP REST or WP API?

You can use wp_ajax action: add_action( ‘wp_ajax_my_awesome_ajax’, ‘my_awesome_func’ ); add_action( ‘wp_ajax_nopriv_my_awesome_ajax’, ‘my_awesome_func’ ); function my_awesome_func() { // Handle request with $_POST wp_die(); } You can submit contact form with jQuery post: jQuery.post( my_awesome_js.ajaxurl, { ‘action’: ‘my_awesome_ajax’, ‘data’: ‘some data’ }, function(response){ alert(response); } ); The my_awesome_js.ajaxurl you use wp_localize_script: wp_enqueue_script(‘my_awesome_js’, ‘/path/to/your/script/above.js’, array(‘jquery’)); wp_localize_script(‘my_awesome_js’, ‘my_awesome_js’, array( … Read more

How to transfer all posts, pages and media

That would involve looping through all posts of all types and then delete the extra fields per post. You could run the following code once in your new theme: $args = array (‘post_type’ => ‘any’, ‘posts_per_page’=>-1) $query = new WP_Query ($args); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $the_query->the_post(); // delete unwanted … Read more