Turn a URL into content preview

It is definitely possible. However, you would need to develop that functionality either in a plugin or adding it to the functions.php file of the active wordpress theme. Are you asking for a functioning example or someone to code it for you?

Using AJAX to load div doesn’t always work

changue this: <script type=”text/javascript”> $(“.mystory-link”).click(function(){ // Your code; return false; }); </script> BY (This is the correct way to use jquery events): <html> <body> <!– anchors –> <a class=”mystory-link” href=”https://www.google.com”></a> <a class=”mystory-link” href=”https://www.yahoo.es”></a> <a class=”mystory-link” href=”https://www.youtube.com”></a> <!– content –> <div id=”mystory-container”></div> <!– javascript –> <script type=”text/javascript”> $(document).on(‘ready’, function(event) { // this method select all Class … Read more

Same query in category.php and in function.php, but different result

Found the answer – the query on the category page had post_status=”publish” by default and the query in the function.php had post_status=”publish” OR post_status=”future” OR post_status=”draft” OR post_status=”pending” as default, so the solution was to be more explicit in the $args and add ‘post_status’ => ‘publish’.

Display SOLDOUT text in Dropdowns of Variable Product in WooCommerce [closed]

Step 1: Add below code to variable.php file located in woocommerce plugin (single-product/add-to-cart) <?php $product_variations = $product->get_available_variations(); echo ‘<ul class=”attr_avail_custom dnone”>’; foreach ($product_variations as $variation) { $var_data = $variation[‘attributes’]; if(!$variation[‘is_in_stock’]) { echo ‘<li>’; foreach ($var_data as $vk => $vv) { echo “<span data-key=$vk data-value=$vv >$vv</span>”; } echo ‘</li>’; } } echo ‘</ul>’; ?> Step 2: … Read more

How to block search engines indexing certain AJAX actions

If an ajax call is indexed it compromises the whole purpose of the application. The cause here is that you are making your call using GET instead of POST as suggested: https://codex.wordpress.org/AJAX_in_Plugins The right way should be along something like : <?php add_action( ‘admin_footer’, ‘my_SHOP_javascript’ ); // Write our JS below here function my_SHOP_javascript() { … Read more

Load .php file into div using ajax

Loading a PHP file the way you try to do it is still a direct access to the file. What you should do is “run” the file during the processing of the ajax request on the server side, and send the result back to the browser. Than you insert the result into the div. Your … Read more

Retrieve Header Background Image with AJAX

It was easier than i thought. After a lot of reading and trying I’ve finally got it ! This is the answer with explications if it can help someone. 1- In functions.php localize hero.js function mytheme_header_script() { // Adding custom javascript file to handle the header image. wp_enqueue_script(‘mytheme-hero’, get_theme_file_uri() . ‘/assets/js/hero.js’, array(‘jquery’), ”, true); // … Read more

Using AJAX on Contact-form the WordPress way

EDIT TL;DRYour page is refreshing because you tell the form to load a new page (the page specified under action). Longer answerThe reason the page refreshes is because your form has an action associated with it. When I viewed your page yesterday, I saw the AJAX routine complete, and then the page refreshed. Why? Because … Read more