How do I display entries in the top menu based on conditions selected in the sidebar menu?

If you have 3 templates, you can use the conditional check is_page_template to check which one is currently in use. See https://developer.wordpress.org/reference/functions/is_page_template/ Or if you weren’t talking about page templates, but rather a specific archive template, you can get the current term id with get_queried_object_id. See https://developer.wordpress.org/reference/functions/get_queried_object_id/ Then, you could register 3 different menu locations … Read more

Show Header When Not In Iframe

I solved this by adding the header php code, and the setting it with display none as below: #main-header { display:none; } Then using JQuery I added the following: <script> if(self==window.top) { $( “header#main-header” ).css( “display”, “inherit” ); $( “div#mce_height” ).css( “margin-top”, “100px” ); } </script> This detects if it is in an iframe, and … Read more

Build custom pdf from users choices

If you are looking for an industrial strength solution, you might consider AppendPDF by Appligent (and/or other products from them). As a command line application, it is very easy to integrate and to run. Alternatively, there are several libraries (such as iText, pdflib, etc.) which could be used to create such customized documents. Ah, yeah, … Read more

DOM reference to TinyMCE editor element (button)

Try adding an id attribute in your button definition: ed.addButton(‘solution’, { disabled: 0,//count_problems(ed).length == 0, id: ‘my_button’, title : ‘Add problem solution’, //cmd: ‘solution_fun’, image : url + ‘/images/wspringer.png’, type: ‘menubutton’, menu: [{text: ‘problem id = ‘ + 1, value: 1}], onselect: function(v1) { ed.windowManager.open({ title: ‘Insert solution in popeye output format’, body: [{type: ‘textbox’, … Read more

A delete/trash all function?

So I couldn’t find anything so I created this. The only drawback is that it will delete the ‘Uncategorized’ term in the Posts, but I can live with this since it’s just for development purpose. function delete_all(){ global $wpdb; $menus = get_terms( ‘nav_menu’, array( ‘hide_empty’ => false ) ); $all_post_types = get_post_types(); $all_taxonomies = get_taxonomies(); … Read more

How to share posts (and plugins) between existing site and new, separate dev/test installation?

There are tools available for simplifying the synchronization of databases between multiple WP installations, such as WP Sync DB. As @jdm2112 mentioned, using a copy of the database—versus attempting to use the same database—reduces the risk of development work interfering with the production environment. However, simply making a copy of one site’s WP database is … Read more

Customizing individual images on posts

The best answer I had was to add a &nbsp in the function callback html at the end of the section tag. This forced the curser out of section wrapper in the WYSIWIG of WordPress. It’s not the perfect fix but it worked. function html5_insert_image($html, $id, $caption, $title, $alt, $align, $url) { $url = wp_get_attachment_url($id); … Read more