plugin development – update_post_meta doesnt update template

I want to set Blank template but this function doesn’t do it.Whats the problem of this code?

register_activation_hook( __FILE__, 'eafw_activate_insert_post' );
function eafw_activate_insert_post() {
    //create a variable to specify the details of page
    $post = array(
        'post_name' => 'dneme1111',
        'post_content'   => 'This is a example content', //content of page
        'post_title'     =>'example title', //title of page
        'post_status'    =>  'publish' , //status of page - publish or draft
        'post_type'      =>  'woocommerceareas',  // type of post
    );
    wp_insert_post( $post ); // creates page
    if ( $post = get_page_by_path( 'dneme1111', 'woocommerceareas' ) ) {
        $id = $post->ID;
    }
    update_post_meta( $id, '_wp_page_template', 'Blank' );
}

List categories with posts – WordPress Development Stack Exchange

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

On/off buttons in Phaser – Game Development Stack Exchange

I am trying to make an on/off button for audio in Phaser, and when you click on the button once it shows the off button, but when I click on it again, the on button does not show. Right now I did not implement the audio feature, I am just working on the button itself first. Here is the code:

 soundOnOff() {
 gameState.on = this.add.image(this.config.width - 20 , 0 + 30, 'on')
 .setScale(2);
 gameState.off = this.add.image(this.config.width - 20 , 0 + 30, 'off')
 .setScale(2)

 gameState.on.setInteractive();
 gameState.off.setInteractive();
 gameState.off.visible = false;

 gameState.on.on('pointerdown', () => {
 gameState.on.visible = false;
 gameState.off.visible = true;
 });

gameState.off.on('pointerdown', () => {
gameState.on.visible = true;
gameState.off.visible = false;
});

}

Please tell me how I can fix this! Also, how do I make my bird, in gameState.bird, not jump when I click the button. Thank You!

Edit Comments Fields – WordPress Development Stack Exchange

I need to edit the comments fields.

1 – The metadata should be only date;
2 – The comment itself should be trimmed;
3 – the word ‘says’ next to the name should be gone;

I believe I can manage the logics, however I do not know how to get these fields, apply the logic, and return them.

enter image description here

<article id="div-comment-5" class="comment-body">
                <footer class="comment-meta">
                    <div class="comment-author vcard">
                        <img alt="" src="https://1.gravatar.com/avatar/710dade4711ee07ca27e7db85255b701?s=50&amp;d=mm&amp;r=g" srcset="http://1.gravatar.com/avatar/710dade4711ee07ca27e7db85255b701?s=100&amp;d=mm&amp;r=g 2x" class="avatar avatar-50 photo" height="50" width="50" loading="lazy">                        <b class="fn"><a href="http://mundo.local" rel="external nofollow ugc" class="url">Stefano Monteiro</a></b> <span class="says">says:</span>                 </div><!-- .comment-author -->

                    <div class="comment-metadata">
                        <a href="http://mundo.local/videos/music-classic-canada-37/#comment-5"><time datetime="2021-01-21T17:59:16+00:00">January 21, 2021 at 5:59 pm</time></a> <span class="edit-link"><a class="comment-edit-link" href="http://mundo.local/wp-admin/comment.php?action=editcomment&amp;c=5">Edit</a></span>                 </div><!-- .comment-metadata -->

                                    </footer><!-- .comment-meta -->

                <div class="comment-content">
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
                </div><!-- .comment-content -->

                <div class="reply"><a rel="nofollow" class="comment-reply-link" href="http://mundo.local/videos/music-classic-canada-37/?replytocom=5#respond" data-commentid="5" data-postid="830" data-belowelement="div-comment-5" data-respondelement="respond" data-replyto="Reply to Stefano Monteiro" aria-label="Reply to Stefano Monteiro">Reply</a></div> 

</article>

plugin development – What’s the right way to tell if a block is rendered in the editor from a front-end/public script?

I’m writing a block that generates a skeleton via server-side render, and then populates the skeleton via React from a public-facing script (i.e., one that loads both on the front-end and the admin side of things). This works fine on the front-end, because the server-side render is triggered … from the server side. So, when the DOM is loaded, I can look for my skeleton, and then insert my React component. However, when in the editor, the server-side render is triggered via ServerSideRender in the block’s edit function, and the content is returned by API; so, the blocks aren’t yet rendered when the DOM is done loading. To work around this, I set a MutationObserver on the editor, and watch for my skeleton(s) to arrive. This seems inelegant. The below code works, but a) is it the Right Way to do this; and b) if it is, when (if ever) is it safe for me to remove the observer?

document.addEventListener("DOMContentLoaded", (event) => {
        let myEls = document.getElementsByClassName("my_class");

        if (myEls.length > 0) {
                for (let myEl of myEls) {
                        render(<MyReactComponent />, myEl);
                }
        } else {
                //we're on an admin page, and the my_class divs arrive
                //later via API call, so we have to watch for their creation
                let editorDiv = document.getElementById("editor");

                const config = { childList: true, subtree: true };

                const callback = (mutationList, observer) => {
                        for (let mutation of mutationList) {
                                if (mutation.type === 'childList' &&
                                    mutation.addedNodes.length > 0 &&
                                    mutation.addedNodes(0).querySelector(
                                        ".my_class")) {
                                        let myContainer =
                                            mutation.addedNodes(0);
                                        let myChild =
                                            myContainer.querySelector(
                                                ".my_class");
                                        render(<MyReactComponent />, myChild);
                                }
                        }
                }

                const observer = new MutationObserver(callback);
                observer.observe(document.getElementById(editorDiv.id),
                    config);

        }

});

theme development – WordPress TopNavigation Menu Not working?

This is weird, has anyone seen this behavior before?

I have just created a site locally (WP 5.6 Windows 10 and IIS) using VS Code as my editor

The top nav menu appears correctly however when you click on a link nothing happens. When I say nothing, I mean nothing, there are no errors in the console, the page doesn’t flicker as if it’s trying to do something. It’s like the link is disabled or something.

All my other localhost sites work just fine. I deleted and created this site several times, I used an existing working site as a template

You can hover the mouse pointer over it and the URL is displayed (bottom left in Chrome). I checked in Chrome inspector and the link is a property formed hyperlink. You can right-click and “open in another tab” and the page works fine and correctly. It just won’t open when you click the link.

The same issue in Chrome, Firefox, IE, and Edge

This is the code from the generated page. I’m using BootStrap 4.5.2, class-wp-bootstrap-navwalker.php (Version: 4.3.0) and Jquery 3.5.1

<div id="navbarCollapse" class="collapse navbar-collapse">
    <ul id="menu-mainmenu" class="nav navbar-nav ml-auto">
        <li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-18" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18 nav-item"><a title="Our Services" href="http://localhost/360sbs/our-services/" class="nav-link">Our Services</a></li>
        <li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-19" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-19 nav-item"><a title="Projects" href="http://localhost/360sbs/projects/" class="nav-link">Projects</a></li>
        <li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-20" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20 nav-item"><a title="Our Story" href="http://localhost/360sbs/our-story/" class="nav-link">Our Story</a></li>
        <li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-21" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-21 nav-item"><a title="Contact Us" href="http://localhost/360sbs/contact-us/" class="nav-link">Contact Us</a></li>
    </ul>
</div>

@media (min-width: 992px)
.navbar-expand-lg .navbar-nav .nav-link {
    padding-right: .5rem;
    padding-left: .5rem;
}
.navbar-nav .nav-link {
    padding-right: 0;
    padding-left: 0;
}
.nav-link {
    display: block;
    padding: .5rem 1rem;
}
a {
    color: #007bff;
    text-decoration: none;
    background-color: transparent;
}
*, ::after, ::before {
    box-sizing: border-box;
}
user agent stylesheet
a:-webkit-any-link {
    color: -webkit-link;
    cursor: pointer;
    text-decoration: underline;
}
user agent stylesheet
li {
    text-align: -webkit-match-parent;
}
.navbar-nav {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}
.nav {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}
user agent stylesheet
ul {
    list-style-type: disc;
}

visual studio – Virtual reality development services

Using the services of the European virtual reality development company ServReality they provide recommendations and specialized services for VR development, their developers release a product for virtual reality for interaction with customers in games, trade, education and other areas. .
Very happy with their service, but wanted to ask if anyone knows other services for more choice ???

Django Development Company

Meet Django
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. Itโ€™s free and open source.

Meet Steelkiwi
Steelkiwi is a python development company. We offer high-quality web solutions in this programming language that goes along with Django development. Build your ideas faster and easier with Python & Django Web Development Services

#python development company #django development company #web development company #mobile development company

Error in Autoptimize Plugin – WordPress Development Stack Exchange

I am getting this error in our Autoptimize plugin.

Error: Element style not allowed as child of element noscript in this context. (Suppressing further errors from this subtree.)

Does anyone know how to fix it?

Thank you!

Sandy