WordPress 5.9 to Introduce New API for Locking Blocks

Category Image 091

The advent of block themes delivers more creative power into the hands of users, but there are times when theme authors may want to lock down key elements of a design and its designated content areas. First introduced in Gutenberg 11.6, the upcoming WordPress 5.9 release will include a new API for locking blocks.

Template level locking has been available in Gutenberg for a few years, allowing developers to lock the template on the UI so that users can’t manipulate the blocks. This new API offers more granular control that can be applied on the block level and override template locking.

“Instead of applying a lock to all inner blocks, you can apply it selectively to individual blocks via the lock attribute,” Marcus Kazmierczak said in the dev note. “The block level locking would supersede the inherited templateLock value. You can choose to lock moving or removing a block.”

One of the primary use cases for locking individual blocks, cited in the ticket proposing the new API, is where one might lock the “post-content” block of a single template so users can’t remove it.

“Another use case that we’re building for is having a Checkout Block with different blocks that act as fundamental steps, we don’t want people to delete or move those steps since they’re fundamental and their order is also important, but we want to allow people to select them, access settings, and insert blocks in between them,” WooCommerce engineer Seghir Nadir said.

Kazmierczak’s dev note demonstrates how developers can lock a specific block in a pattern and explained how block level locking is not inheritable.

“If a block is locked from being removed, its children can still be removed,” Kazmierczak said. “If you want to apply locking on children as well, add templateLock to the inner block component, or templateLock attribute to supporting blocks.”

For more information on the new locking mechanism, check out the Block Editor Handbook and the code examples in the dev note.

How to Change the WooCommerce Shop Page Title (Quick & Easy)

Set Up Woocommerce

Do you want to change the shop page title in WooCommerce?

By default, your main shop page is simply called ‘Shop’. You may want to change the default title to be more descriptive and engaging, and better reflect your brand.

In this article, we’ll show you how to change the WooCommerce shop page title easily.

How to change the WooCommerce shop page title (quick & easy)

Why Change the Shop Page Title in WooCommerce?

When you install WooCommerce, it will automatically create pages like your shop page, account page, checkout page, and more.

By default, the shop page title will be ‘Shop’, but you can change this to anything you want, like ‘Boutique’ or ‘Store’ or something more detailed and descriptive. Overall, this can help create a better shopping experience and help build trust with your visitors.

Customizing your shop page title can also help your WooCommerce search engine optimization. Google and other search engines look at the words used in page titles to determine how to rank them in search results. If your shop page title is more descriptive, it can help you get more traffic to your online store.

With that said, let’s show you how to easily change the WooCommerce shop page title. Simply use the quick links below to jump straight to the method you want to use.

Method 1: Changing the WooCommerce Shop Page Title with Built-in WordPress Settings

The easiest and most beginner friendly way to change the shop page title in your online store is by using the built-in settings.

To change the title of your shop page, simply go to Pages » All Pages. You’ll need to find the page that says ‘Shop – Shop Page’ and then hover over it and click the ‘Edit’ button.

Go to all pages and open shop page

From here, you can enter a new page title at the top of the page.

Make sure to click the ‘Update’ button to save your changes.

Add new shop page title

Now, you can visit your shop page, and you’ll see your new shop page title live.

Changing your shop page title this way will update your breadcrumbs and navigation menu too.

Shop page new title example

Method 2: Changing the WooCommerce Shop Page Title by Adding Code to WordPress

Some WooCommerce themes might not give you the option to change your shop page title.

To do this, you’ll need to add code to WordPress. If you haven’t done this before, then see our guide on how to copy and paste code in WordPress.

Then, you can add the following code snippet to your functions.php file, in a site-specific plugin, or by using a code snippets plugin

add_filter( 'woocommerce_page_title', 'new_woocommerce_page_title');
 
function new_woocommerce_page_title( $page_title ) {
 
  if( $page_title == 'Shop' ) {
 
    return "New Shop Title";
 
  }
 
}

Make sure you replace the ‘New Shop Title’ with your own shop page title in the snippet above.

Now, you can visit your online shop page to see your new title live. You’ll notice this method doesn’t change the shop page URL or WooCommerce breadcrumbs, but only changes the title on the page itself.

Shop page title example with code

Method 3: Changing the WooCommerce Shop Page SEO Title with a WordPress Plugin

Another way to change your WooCommerce shop page title is by changing the shop title that shows up in the search engines, which is called the SEO title or title tag.

This can be a great way to get more traffic and target more relevant keywords related to your online store.

The easiest way to do this is by using the AIOSEO plugin. It’s the best WordPress SEO plugin in the market used by over 3 million websites. 

AIOSEO

You can use the plugin easily optimize your SEO title to improve your search engine rankings.

For more details on setting up the plugin, see our guide on how to setup All in One SEO for WordPress correctly.

After that, you can easily change your shop page SEO title by opening up your shop page and scrolling down to the ‘AIOSEO Settings’ box beneath the page editor.

You can use smart tags to automatically generate the shop page title, or enter a custom title instead.

AIOSEO shop page title

If you want to fully customize the title and page design of your WooCommerce shop page, then we recommend using SeedProd.

It’s a drag & drop design builder that lets you customize every Aspect of your WooCommerce store.

SeedProd WooCommerce Design Builder

We hope this article helped you learn how to change the WooCommerce shop page title. You may also want to see our expert pick of the best WooCommerce plugins and best WooCommerce hosting for creating a successful online store.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Change the WooCommerce Shop Page Title (Quick & Easy) first appeared on WPBeginner.

countdown with 3 label, (hh:mm:ss) when reach 1 minute timer freeze

558fe5180e0e8fc922d31c23ef84d240

Hi, I have a issues, in this code I have a countdown with function declared, the issues now is that, if starting the time with only seconds timer go well but if the timer go to one minute if button is clicked timer suddently stop. Is there anything wrong with the code?

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        If Label5.Text = 0 AndAlso Label8.Text = 0 AndAlso Label7.Text < 59 Then
            Label7.Text = Label7.Text - 1.ToString
            If Label5.Text = 0 AndAlso Label8.Text = 0 AndAlso Label7.Text = 0 Then
                Timer1.Stop()
                MsgBox("timer out", MessageBoxButtons.OK)
            End If
            If Label7.Text = 0 AndAlso Label8.Text > 1 Then
                Label8.Text = Label8.Text - 1.ToString
                Label7.Text = 59
            ElseIf Label5.Text >= 0 AndAlso Label8.Text >= 0 AndAlso Label7.Text = 59 Then
                Label7.Text = 59
                Label8.Text = 59
                Label7.Text = Label7.Text - 1.ToString
                Label8.Text = Label8.Text - 1.ToString
                Label5.Text = Label5.Text - 1.ToString
            End If
        End If
    End Sub

How To Use Sticker Paper

Featured Imgs 23

Sticker papers are getting several uses from time to time in the current world. Traditionally, people used to get sticker papers from the shops and stores where they came with already made appearances. Today, due to technological advancement, you can create customized sticker paper for your use. Sticker papers come in various forms to meet...

The post How To Use Sticker Paper appeared first on DesignrFix.

API Prototyping with Postman

Featured Imgs 26

Introduction

Whether you’re a longtime Postman developer or new to the platform, Postman brings you all the tools you need to make the process easier, faster, and more streamlined.

In this article, we’ll show how Postman can help you start building the core of your API-driven integration on both sides of the API—either as the provider or the consumer.

Problems in sorting element inside an array of object.

558fe5180e0e8fc922d31c23ef84d240

i have initialized the elements of the array by reading the strings from a file, however when I call the sort function, either the program crashes or it just outputs NULL. What could be a more efficient way to store data from a file?

the file that I have opened contains the following text:
"
ppp zaeem na2 lun
pti farea na1 balla

"

#include <iostream>
#include <string>
#include <stdlib.h>
#include <Conio.h>
#include <cstdlib>
#include <string>
#include <string.h>
#include <cstring>
#include <fstream>
using namespace std;

class candidate
{
public:
    string party;
    string name;
    string constituency;
    string symbol;

    candidate()
    {
        party = "";
        name = "";
        constituency = "";
        symbol = "";
    }
};

candidate *candi = new candidate[3];
int size = 0;

void read_into_array()
{
    int i = 0;
    string name, party, consti, symb;
    ifstream a("new.txt");
    if (!a)
        cout << "file not found." << endl;
    else
    {

        a >> party >> name >> consti >> symb;
        while (!a.eof())
        {   

            candi[i].party = party;
            candi[i].name = name;
            candi[i].constituency = consti;
            candi[i].symbol = symb;
            a >> party >> name >> consti >> symb;

            size++;
            i++;
        }
        a.close();
    }
}
class voter
{
public:
    void show_all_candidates()
    {
        for (int i = 0; i < size; i++)
        {
            cout << "Candidate's Name:  " << candi[i].name << endl;
            cout << "Candidate's Constituency:  " << candi[i].constituency << endl;
            cout << "Candidate's Party'" << candi[i].party << endl;
            cout << "Party Symbol:  " << candi[i].symbol << endl;
        }
    }

    void sort_by_name()
    {
        for (int i = 1; i < size; i++)
        {
            for (int j = 1; j <size-i; j++)
            {
                string temp=" ";
                if (candi[j].name > candi[j + 1].name)
                {

                    temp=candi[j].name;
                    candi[j].name = candi[j + 1].name;
                    candi[j + 1].name = temp;

                    temp=candi[j].constituency;
                    candi[j].constituency = candi[j + 1].constituency;
                    candi[j + 1].constituency = temp;

                    temp=candi[j].party;
                    candi[j].party = candi[j + 1].party;
                    candi[j + 1].party = temp;

                    temp=candi[j].symbol;
                    candi[j].symbol = candi[j + 1].symbol;
                    candi[j + 1].symbol = temp;
                }
            }
        }
    }
};

int main()
{
    voter obj_voter;

    read_into_array();
    obj_voter.sort_by_name();
    obj_voter.show_all_candidates();
   // obj_voter.sort_by_name();
}

for next loop doesn’t count last line on a textbox

558fe5180e0e8fc922d31c23ef84d240

Like title, more particulary, I have two textbox when user put links when finished the result will be on the second one with some default string in the 0 index of the counter and after the exiting of the loop. My question is how I can make that even the last line will be readed in the for loop? Because I was thinking that the problem will be in the temparray=textbox1.Lines

 tempArray = TextBox1.Lines
        For counter = 0 To tempArray.Length - 1
            If counter = 0 Then
                tempArray(0) = cbname2
            ElseIf counter = 1 Then
                tempArray(1) = "~!" & "img(" & tempArray(counter) & ")"
            ElseIf counter >= 2 Then
                tempArray(counter) = "img(" & tempArray(counter) & ")"
            End If
            TextBox2.Lines = tempArray
        Next
        TextBox2.Text &= vbCrLf & "!~" & " ~~~"
    End Sub

8 Interesting Typography Links for January 2022

Typography Definitions Cover

Every now and then, I find that I’ve accumulated a bunch of links about various things I find interesting. Typography is one of those things! Here’s a list of typography links to other articles that I’ve been saving up and think are worth sharing.

A specimen of the Retail typeface, once of the typography links in the list.
An awesome new font from OH no Type Company

Do you have any interesting typography links from the past month worth sharing? Drop ’em in the comments!


8 Interesting Typography Links for January 2022 originally published on CSS-Tricks. You should get the newsletter and become a supporter.

Adam Argyle’s Sick Mouse-Out CSS Hover Effect

Category Image 091

I was killing some time browsing my CodePen feed for some eye candy and didn’t need to go past the first page before spotting a neat CSS hover effect by Adam Argyle.

I must’ve spent 10 minutes just staring at the demo in awe. There’s something about this that feels so app-like. I think it might be how contextually accurate it is in that the background color slides in from the left, then exits out through the right. It’s exactly the sort of behavior I’d expect from a mouse-in, mouse-out sort of interaction.

Whatever the case, I fired up a fresh pen and went to work recreating it. And it’s not super complex or anything, but rather a clever use of transitions and transforms paired with proper offsets. Quite elegant! I’m actually a little embarrassed how long it took me to realize how the mouse-out part works.

Here’s how I tackled it, warts and all.

“I bet that’s using a transition on a background.”

That was my first thought. Define the background-color, set the background-size and background-position, then transition the background-position. That’s how I’ve seen that “growing” background color thing done in the past. I’ve done that myself on some projects, like this:

If I could do the same thing, only from left-to-right, then all that’s left is the mouse-out, right? Nope. The problem is there’s nothing that can really make the background-position transition from left-to-right to left-to-right. I could make it do one or the other, but not both.

“Maybe it’s a transform instead.”

My next attempt was jump into transforms. The transform property provides a bunch of functions that can transition together for slightly more complex movement. For example, the background can “grow” or “shrink” by changing the element’s scale(). Or, in this case, just along the x-axis with scaleX().

But like I mentioned, there isn’t a way to isolate the element’s background to do that. Going from scaleX(0) to scaleX(1) scales the entire element, so that basically squishes the link — content and all — down to nothing, then stretches it back out to its natural size which is a totally different effect. Plus, it means starting with scaleX(0) which hides the whole dang thing by default making it unusable.

But a pseudo-element could work! It doesn’t matter if that gets squished or hidden because it isn’t part of the actual content. Gotta put the background on that instead and position it directly under the link.

a {
  /* Keeps the pseudo-element contained to the element */
  position: relative;
}

a::before {
  background: #ff9800;
  content: "";
  inset: 0; /* Logical equivalent to physical offsets */
  position: absolute;
  transform: scaleX(0); /* Hide by default */
  z-index: -1; /* Ensures the link is stacked on top */
}

“Now I need ::before to change on hover.”

I knew I could make ::before scale from 0 to 1 by chaining it to the link element’s :hover state.

a:hover::before {
  transform: scaleX(1)
}

Nice! I was onto something.

Sprinkle a little transition fairy dust on it and things start to come to life.

a::before {
  background: #ff9800;
  content: "";
  inset: 0;
  position: absolute;
  transform: scaleX(0);
  transition: transform .5s ease-in-out;
  z-index: -1;
}

“Hmm, the transition moves in both directions.”

Again, this is where I sorta got stuck. Something in my head just wasn’t clicking for some reason. As per usual, I ran over to the CSS-Tricks Almanac to see what property might’ve slipped my mind.

Ah, yes. That would be transform-origin. That allows me to set where the transform starts, which is not totally dissimilar from setting the background-position like I tried earlier. The transform could start from the left instead of its default 50% 50% position.

a::before {
  background: #ff9800;
  content: "";
  inset: 0;
  position: absolute;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s ease-in-out;
  z-index: -1;
}

Yeah, like this:

I was already transitioning ::before to scaleX(1) on link hover. If I reversed the transform-origin from left to right at the same time, then mayyyybe the highlight goes out the opposite of how it came in when the mouse exits?

a:hover::before {
  transform: scaleX(1);
  transform-origin: right;
}

🤞

Whoops, backwards! Let’s swap the left and right values. 🙃

Gorgeous. Thank you, Adam, for the inspiration!


Adam Argyle’s Sick Mouse-Out CSS Hover Effect originally published on CSS-Tricks. You should get the newsletter and become a supporter.

sub of a event handler (dynamically generated, combobox, textbox, button)

558fe5180e0e8fc922d31c23ef84d240

Hi all, I have created an Event handler to a function for clicking a generated button, now when this button is clicked need to paste in a textbox the Combobox.seleteditem (that it's a string. Each generated one (Combobox, textbox, button) will have a selected index of the Combobox that it's different, but that is not the problem because I put it in an if, the issues it's that I can't put inside this sub all the three-component. After all, it tells me that the windows form button cannot be a textbox, etc. Do I need to put another two event handlers for textbox and Combobox? (The code below it's a workaround, but I Like to do this with a button)

Public Sub btn_Click(sender As System.Object, ByVal e As System.EventArgs)
        'Dim btn As New Button
        'btn = CType(sender, Button)
        'Dim txt As New TextBox
        'txt = CType(sender, TextBox)
        Dim cbx As New ComboBox
        cbx = CType(sender, ComboBox)
        TextBox4.Text += cbx.SelectedItem.ToString & vbCrLf
    End Sub

not displaying the union and intersection of sets in output

558fe5180e0e8fc922d31c23ef84d240
#include<iostream>
using namespace std;
class Sports
{
    public:
        int tennis;
        int badminton;
        int cricket;
        int setA[20],setB[20],setC[20];
        int ab[20],bc[20],ca[20],abc[20];
        int n1,n2,n3,n4=0,total;
        void accept();  // method for accept the input
        void intersection();    //method for calculate intersection
        void display(); //method for display intersections
};
void Sports :: accept()
{
    cout<<"Enter the total number of players who play Tennis: "<<endl;
    cin>>tennis;
    cout<<"Enter the student roll no who play Tennis "<<endl;
    for(int i=0; i<tennis; i++)
        cin>>setA[i];

    cout<<"Enter the total number of players who play Badminton: "<<endl;
    cin>>badminton;
    cout<<"Enter the student roll no who play Badminton "<<endl;
    for(int i=0; i<badminton; i++)
        cin>>setB[i];

    cout<<"Enter the total number of players who play cricket: "<<endl;
    cin>>cricket;
        cout<<"Enter the student roll no who play cricket "<<endl;
    for(int i=0; i<cricket; i++)
        cin>>setC[i];

}
void Sports :: intersection()
{
    // Logic for intersection SET-A and SET-B

    for(int i=0;i<cricket;i++)
    {
         for(int j=0;j<badminton;j++)
         {
            if(setA[i]==setB[j])
            {
                ab[n1]=setA[i];
                n1++;
            }
         }  
    }

    // Logic for intersection SET-B and SET-C
    for(int i=0;i<badminton;i++)
    {
         for(int j=0;j<cricket;j++)
         {
            if(setB[i]==setC[j])
            {
                bc[n2]=setB[i];
                n2++;
            }
         }  
    }
    // Logic for intersection SET-C and SET-A
    for(int i=0;i<cricket;i++)
    {
         for(int j=0;j<tennis;j++)
         {
            if(setC[i]==setA[j])
            {
                ca[n3]=setC[i];
                n3++;
            }
         }  
    }
    //logic for A union B union C
    for(int i=0;i<tennis;i++)
    {
         for(int j=0;j<badminton;j++)
         {
            for(int k=0;k<cricket; k++)
            {
                if(setA[i]==setB[j] && setA[i]==setC[k])
                {
                    abc[n4]=setA[i];
                    n4++;
                }
            }
         }  
    }
   total=tennis+badminton+cricket-n1-n2-n3+n4;  
}
void Sports :: display()
{
    //logic for print intersection of tennis and Badminton
    cout<<"\nIntersection of SET-A and SET-B: ";
    for(int i=0; i<n1; i++)
        cout<<ab[i]<<" ";

    //logic for print intersection of Badminton and Cricket  
    cout<<"\nIntersection of SET-B and SET-C: ";
    for(int i=0; i<n2; i++)
        cout<<bc[i]<<" ";

    //logic for print intersection of Cricket and Tennis
    cout<<"\nIntersection of SET-C and SET-A: ";
    for(int i=0; i<n3; i++)
        cout<<ca[i]<<" ";

    // logic for print intersection of Tennis and Badminton and Cricket
    cout<<"\nIntersection of SET-A and SET-B and SET-C: ";
    for(int i=0; i<n4; i++)
        cout<<abc[i]<<" ";

    // logic for print total number of students in a class
    cout<<"\nTotal number of students in class are : "<<total;
}
int main()
{
    Sports s;
    s.accept();
    s.intersection();
    s.display();
    return 0;
}

pll.png