Modals using loops and ACF [closed]

You’re right you should be using an id. I would use a counter in conjunction with get_the_ID(); $arr_posts = new WP_Query( $args ); if ( $arr_posts->have_posts() ) : $index = 0; while ( $arr_posts->have_posts() ) : $arr_posts->the_post(); echo $index . ‘_’ . get_the_ID(); endwhile; endif; This will give you a unique id which you can … Read more

Enqueuing javascript files

Example for themes I would recommend using wp_enqueue_script with get_theme_file_uri this allows child themes to overwrite this file. get_theme_file_uri() function Searches in the stylesheet directory before the template directory so themes which inherit from a parent theme can just override one file. wp_enqueue_script( ‘example-script’, get_theme_file_uri( ‘/js/example-script.js’ ), array(‘jquery’), null, true ); Example for plugins wp_enqueue_script( … Read more

How can I get the standard WP-Editor through Javascript?

Ok I found the solution here Just do wp.editor.initialize(‘editor_id’, { tinymce: true, quicktags: true }); And then add buttons to the toolbar like so: jQuery( document ).on( ‘tinymce-editor-setup’, function( event, editor ) { if(editor.id !== ‘editor_id’) return; editor.settings.toolbar1 += ‘,mybutton,alignleft,aligncenter,alignright,fontselect,hr’; editor.addButton( ‘mybutton’, { text: ‘My button’, icon: false, onclick: function () { editor.insertContent(“It’s my button!”); … Read more

Sending jsPDF documents to the server

Keep in mind not everyone is running JavaScript, so you really need a server-side form processor like PHP rather than relying solely on jQuery. Best thing to do on a WordPress site is create a plugin that processes your form. You can include helper libraries like FPDF to not only generate the PDFs but that … Read more

My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!

Ok, I managed to solve this issue because I was using the wrong WP functions to point my child themes directory and thus my bundled javascript script. I cleared out my functions.php file and added the below and it all works now: function load_js_files() { wp_enqueue_script( ‘script’, get_stylesheet_directory_uri() . ‘/js/scripts-bundled.js’, array ( ‘jquery’ ), 1.1, … Read more

Slide in Panel WordPress Post

The reason why your query fails is the following. You are finishing the loop before your cd-panel with <?php endwhile; wp_reset_postdata(); ?> which is correct. However, after that you are simply using <?php the_title(); ?>, <?php the_content(); ?> which is just a single template tag, and in your case, outputs the title of the first … Read more

Write text below a specific part of a sentence

Maybe you could find the x/y-position of the span with Javascript and position another div with an increased y-position? I don’t think there will be an out-of-the box css solution to this problem. Here is a quick example: <!DOCTYPE html> <html lang=”en”> <head> <meta name=”viewport” content=”width=device-width” /> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <style> p {font-size: … Read more