Generate a custom nested layout by tinymce editor button

I create a new button in TinyMCE editor. And i want that new button of TinyMCE editor will show this below structure as dummy content while I press that button.

<div class="table-of-contents-container">
    <section class="table-of-contents">
        <h2>Topic</h2>
        <ul class="items">
            <li><a href="#">Settings</a></li>
            <li><a href="#">Controls</a>
                <ul>
                    <li><a href="#">Core Custom Controls</a></li>
                </ul>
            </li>
            <li><a href="#">Sections</a></li>
            <li><a href="#">Panels</a></li>
            <li><a href="#">Custom Controls, Sections, and Panels</a>
                <ul>
                    <li><a href="#">Customizer UI Standards</a></li>
                </ul>
            </li>
            <li><a href="#">Custom Setting Types</a>
            </li>
        </ul>
    </section><!-- .table-of-contents -->
</div>

In .js file how i join this whole html tag’s, class and id and output it. My wordPress version is 5.5.1. Please help me.

Go to Source
Author: Zahid Hossain

How do I change the markup only of a built-in widget?

I’m developing a theme and I’d like to slightly alter some of the HTML output of some of the built-in widgets. As of now, I managed to change the sidebar search widget by creating a searchform.php file in my theme — though that might not only be the sidebar widget but alright.

I’m now onto the Archives widget. I literally just need to alter the bit that says “Archives” to change its tag and add a class. Do I really need to make my own (largely identical) class and register it and use my custom widget instead?

(If you can’t tell, I haven’t touched WP theming in around 10 years 🙂

Go to Source
Author: Morpheu5

How do I check if a theme has a file single-cpt.php?

I’m creating a cpt plugin that will add ‘single-cpt.php’ in the theme directory.
The following code works but only if I put it in a functions.php (theme) folder.

// check if the file exists
$checkFile = locate_template('single-cpt.php');
if (!empty($checkFile)) {
    echo "Found!";
} else {
    echo "Not found";
}

How do I get the plugin check if the current theme has that single-cpt.php file ?

Go to Source
Author: Ash

Custom pages with html in wordpress editor vs. writing it all directly in the php template files?

I am building a custom theme from a previous html site I built. Some pages I have set up using advanced custom fields so the client can change parts of those pages. I set those up using page-{slug}.php. I have other pages that won’t change at all, also using page-{slug} for these…..is it ok to just put all the code and content in the php template? Since if there are any changes, I will be the one handling them.

Also, this theme will never be redistributed so won’t need to work on another theme.

Thanks for the help…

Go to Source
Author: user55555

images click popup form and submit images captions in email to admin?

Create Custom Post gallery..archive page display images.
customer can click Enquiry Now button.. this button popup form submit all detalies name,email,phone no,msg to send email to admin

Go to Source
Author: Ashvin Monpara

How to get where an object first instantiated

I have built a theme options class so i can build as many option pages as i want, an i implement a singleton design pattern to fetch options only once, and i have WPML plugin installed so i am trying to make options multilingual using the available hook wpml_multilingual_options and every thing seems to be saved and also displayed correctly on frontend but unfortunately in the admin it keeps showing the none translated options, so i am guessing that the singleton object is called somehow before the init hook where the wpml_multilingual_options is hooked to. But i can’t find where exactly that singleton object is. can i track an object of the same singleton to find out the path of where the first instantiation occurs.

Go to Source
Author: Mohamed Omar