Content Source:
- searchenginejournal.com
- wpbeginner.com
WordPress 6.0 was released earlier this week, and it is the second major release of 2022.
Several notable updates, which you can read more about in the following sections, include:
Some of the changes, like faster website performance, will be felt immediately. Others, like the brand new page creation patterns, are features for theme developers to roll out.
The official WordPress announcement explains:
“The latest version of the software takes full site editing one step further and looks to consolidate the ‘no code’ experience for site-building, expanding upon the existing customization tools, bringing new blocks, and focusing on the writing and design workflows. An example of this is the new style switcher for block themes, one of the most anticipated features for the flexibility and creative opportunities it introduces without having to switch themes. ‘With thoughtful updates to the writing experience, building better block functionality, and adding a new intuitive style switcher, I’m really proud of the work that’s been done in this release to make a great site editing experience,’ says WordPress’ Executive Director, Josepha Haden Chomphosy.”
WordPress 6.0 is the culmination of the work of over 500 people in at least 58 countries, encompassing close to 1,000 improvements.
Ordinarily, when a product undergoes a version change, like a new Android phone model, end-users expect to see dramatic changes. That’s not really the case with WordPress version changes.
While this is a “dot 0” release, version 6.0 is best understood as part of a series of incremental improvements meant to preserve backward compatibility while also introducing improvements.
WordPress 6.0 is a version number change but it’s not on the scale of a revamp. The publishing experience between versions 5.9 and 6 is improved.
According to the official WordPress announcement, there is no need to be wary of updating, encouraging all site owners to update now in order to enjoy the many benefits of this release.
“Site owners and administrators should upgrade to take full advantage of the many stability, performance, and usability enhancements today. WordPress content creators will enjoy a suite of new features geared toward improving the writing and designing experiences.”
One of the most important changes is the Page Creation Patterns feature.
Ordinarily, when creating a web page a publisher might start with a blank layout. Page creation patterns is a way to select from multiple layouts as a starting point.
The WordPress core itself won’t ship with the layouts, this is something that theme developers need to build into their themes.
Block Locking is a feature that prevents an end-user from accidentally deleting or moving an important block. The new feature is available through a block settings drop-down menu.
Andrew Wilder of the WordPress support company, NerdPress offered his opinion that while 6.0 ships with “tons” of improvements that end users will like, he believes that the page creation patterns feature is one that they will most appreciate.
Wilder said:
“For many of our clients, the Page Creation Patterns will be really helpful, especially once plugins are available to pre-built patterns that are specific to their content. That could be a huge time-saver! I’m also glad to see the new Block Locking feature – right now it doesn’t let you lock changes to the block content, but it can stop you from accidentally moving or deleting a block.”
WordPress 6.0 comes with an easy way to switch your entire theme style with a single click.
Click on the Style button at the top right corner and then switch to the Browse Styles tab to see available styles for your theme.
Theme styles is a WordPress theme feature and its availability depends on your WordPress theme.
WordPress 6.0 brings the ability to edit even more templates inside the theme editor.
The new archive templates that you can edit include:
WordPress 6.0 now allows you to save and export all the changes you made to your block theme.
WordPress will prepare a theme zip file that includes all the changes you made using the full site editor. You can then download and install that theme on any other WordPress website.
In the new blocked-based WordPress editors, creating a web page layout is done using what’s called blocks, building blocks, so to speak.
Blocks are like containers where content can be inserted. Content can be images, text, whatever.
An example of an incremental but exciting change in WordPress 6.0 is the ability to select text across multiple content blocks.
This allows a user to select the content within multiple blocks without selecting multiple blocks themselves. This gives publishers the ability to write and control content in an expected manner, contributing to a more intuitive writing experience.
Another exciting new feature is called Global Style Variations.
Style variations allows theme authors to provide their customers a way to easily change the look and feel of their website without having to edit CSS or HTML, dramatically speeding up the process of getting a website up and running.
This is a feature that is implemented on the WordPress theme developer side which improves the WordPress publishing experience for end users.
If you view your media library in the list view, then you can now see a ‘Copy URL to clipboard’ link below each image and media file.
Something that may be useful to consider about WordPress 6.0 is that the Full Site Editor (FSE) is still labeled as Beta.
WordPress 6.0 improves the editing experience for the end users by making the process of writing easier as well as making it easier to dream up unique website layouts without having to deal with code. But FSE is still considered as a Beta product.
For more information and to build the website using WordPress, Hire WordPress Developer from us as we provide you high-quality services by utilizing all the latest themes, plugins, and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop a custom website, plugin, or theme using WordPress, please visit our technology page.
Content Source:
Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a standalone ChromeDriver installation. However, you are free to utilize any other Selenium compatible driver you wish.
To get started, you should add the laravel/dusk
Composer dependency to your project:
composer require --dev laravel/dusk
Once Dusk is installed, you should register the Laravel\Dusk\DuskServiceProvider
service provider. Typically, this will be done automatically via Laravel’s automatic service provider registration.
After installing the Dusk package, run the dusk:install
Artisan command:
php artisan dusk:install
A Browser directory will be created within your tests directory and will contain an example test. Next, set the APP_URL environment variable in your .env file. This value should match the URL you use to access your application in a browser.
To run your tests, use the dusk Artisan command. The dusk command accepts any argument that is also accepted by the phpunit
command:
php artisan dusk
Laravel Dusk is a powerful browser automation tool for Laravel. With Dusk you can programmatically test your own applications or visit any website on the internet using a real Chrome browser. Using Dusk you can automate repetitive tasks, scrape information from other sites or test to make sure your app always works in the browser. In this tutorial we’ll go through how to create a job, login to a mythical website and click around.
Create a new Laravel app:
$ laravel new dusk-scraper $ composer require --dev laravel/dusk $ php artisan dusk:install Dusk scaffolding installed successfully.
In the tests/DuskTestCase.php file that Laravel generated you will have a call to startChromeDriver
in the prepare function (below). The prepare function gets called before the Dusk test is executed. It’s an abstract class so probably not a good place for us to put our code. We can make a new fresh dusk test case that extends the DuskTestCase with an Artisan command:
$ php artisan dusk:make ScrapeTheWebTest
This file (ScrapeTheWeb.php) will appear in tests/Browser directory. You can run the test with another Artisan command:
$ php artisan dusk-scraper
Right now it does not do anything. Here is the code to login to a website and click some buttons:
namespace Tests\Browser; use Tests\DuskTestCase; use Laravel\Dusk\Browser; use Illuminate\Foundation\Testing\DatabaseMigrations; class ScrapeTheWebTest extends DuskTestCase { private $order_ids; public function __construct($name = null, array $data = [], $dataName = '') { parent::__construct($name, $data, $dataName); $this->user_ids = [ 1, 2, 3, ]; } /** @test */ public function loginAndClickButton() { $this->browse(function (Browser $browser) { $browser->visit('https://website.com/login') ->type('input .usernameField', env('USERNAME')) ->type('input .passwordField', env('PASSWORD')) ->click('#login') ->waitForText('Orders'); @foreach($this->user_ids as $user_id) { $browser->visit('https://website.com/users/' . $user_id) ->waitForText('This is protected page') ->click('button .button-im-looking-4') ->waitForText('Page after the button') ->click('.another #button') ->pause(4000); } }); } }
We’m using environment variables to store the values for username and password so in case they are sensitive you don’t have to check them in to version control. To find elements on the page use CSS selectors and browser devtools to target specific elements. We filter through some custom numbers and visit websites dynamically based on this data.
Your tests will run in the terminal with the php artisan dusk command
. The fun really comes in when you see the browser perform the actions you specify. By default Laravel Dusk runs what’s called a headless browser that you won’t be able to watch. To watch the browser perform actions head to DuskTestCase.php that our ScrapeTheWebTest inherits from. Once there remove the --headless
option:
/** * Create the RemoteWebDriver instance. * * @return \Facebook\WebDriver\Remote\RemoteWebDriver */ protected function driver() { $options = (new ChromeOptions)->addArguments([ '--disable-gpu', //'--headless' ]); return RemoteWebDriver::create( 'http://localhost:9515', DesiredCapabilities::chrome()->setCapability( ChromeOptions::CAPABILITY, $options ) ); }
With the headless option removed you can run the tests and watch the browser perform the actions that you specified! From this command you can use the full power of Laravel to create database records, trigger jobs, update data or anything else you can think of.
For more Information and to build a website using Laravel, Hire Laravel Developer from us as we give you a high-quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop the custom website using Laravel, please visit our technology page
Content Source:
Each time a new version of WordPress rolls out, we’re all excited about getting to play with its new features. However, few versions in the past have garnered as much buzz around them as WordPress 5.0 because of these two simple words: the new block-based editor – otherwise known as Gutenberg.
Note: WordPress 5.0.1 is now available. This is a security release for all versions since WordPress 3.7.
The old WordPress editor was a simple text window. While it worked well, you had to use different approaches to add images, create galleries, shortcodes, video embeds, and other content elements.
The new editor replaces them with a streamlined writing experience where each content element is wrapped in a block. You can move them around the editor, change their settings, and create engaging layouts without writing code.
By default, it comes with several blocks to add most commonly used content elements. This includes blocks to add images, audio, video, photo gallery, cover image, lists, quote, media, text, buttons, and more.
Blocks come with their own toolbar and settings. Apart from basic formatting options, you can also change width, colors, and other attributes.
Widgets are also included as blocs, so you can easily add shortcodes, recent posts, recent comments, categories, and archives.
If you relied on adding shortcodes to your articles, then you can continue using them as a block.
The new editor also makes embeds much easier. Simply expand the embeds section under the add block button, and you will be able to see all supported embed options.
This makes adding videos, tweets, and facebook embeds a lot easier. Each embed is its own block, so you can adjust their settings just like any other blocks.
If you feel a bit distracted by the WordPress admin sidebar, then simply switch to the distraction-free full-screen mode. This will hide the WordPress admin sidebar, and you will have a lot more room to design your content.
You will find all your usual post editing features neatly tucked under the sidebar. This includes publishing and saving options, permalink or post-slug, categories and tags, excerpt, and more.
WordPress 5.0 ships with a new default theme called Twenty Nineteen. It is a versatile and minimalist WordPress theme that can be used to start a blog or make a website.
Twenty Nineteen is based on Gutenberg starter theme, which means it is fully compatible with the new WordPress editor. It offers a clean canvas with minimal distractions, which gives you the freedom to experiment with the new editor and create beautiful layouts for your WordPress posts and pages.
WordPress 5.0 brings a big change to how users create content using WordPress. It has been under development for quite some time, which provided plugin and theme developers enough time to test their products and add compatibility for the new editor.
Most essential WordPress plugins like WPForms and Yoast SEO are already compatible with WordPress 5.0 and the new editor.
Alternatively, you can install the ‘Classic Editor’ plugin until your favorite plugin/theme have switched over.
For more Information and to build the website using WordPress, Hire WordPress Developer from us as we provide you high quality services by utilizing all the latest themes, plugins and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop custom website, plugin or theme using WordPress, please visit our technology page.
Content Source:
Laravel Nova, the latest addition to the Laravel ecosystem has arrived. So, what exactly is it?
Well, straight from the marketing website it’s defined as, “a beautifully designed administration panel for Laravel. Carefully crafted by the creators of Laravel to make you the most productive developer in the galaxy.” It can be everything from an admin panel to a CMS to a CRM, and I’m just scratching the surface. It’s rocket fuel for your Laravel projects that lets you focus on the features that matter to your users.
First things first, you’ll need to head over to the Nova website and register for an account. Once you’re in, you’ll need to purchase a license to get access to the code.
Once you have a license, you can download the Nova files to your machine. Next, create a new Laravel project using laravel new <your-project-name>
or you can add it to an existing project. From the command line, I used mv <path-to-nova-download> <path-to-my-project-nova-directory>
to add it. This way, I was sure to include all of the hidden files like the .gitignore
With the source code in place, you can configure your composer.json to recognize Nova by adding this snippet:
"repositories": [ { "type": "path", "url": "./nova" } ],
Then, you’ll add Nova to the require section of composer.json like this:
"require": { "php": "^7.1.3", "fideloper/proxy": "^4.0", "laravel/framework": "5.6.*", "laravel/nova": "*" },
Before running the installation commands, make sure you configure your DB in your .env
.
With that setup, you can run the following commands from your terminal to install Nova:
composer update php artisan nova:install php artisan migrate
Bada bing bada boom, Nova is now installed in our project! We can now navigate to the /nova
route and see the login screen.
To log in, we need to create a user. Nova includes an out-of-the-box command so we can register anyone on the fly. We can run php artisan nova:user
in our terminal and follow the prompts to add our first user. Now, we’re ready to log in and start our blog!
For more Information and to build a website using Laravel, Hire Laravel Developer from us as we give you a high-quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop the custom website using Laravel, please visit our technology page
Content Source:
You’ve probably cached some model data in the controller before, but here’s we like to show you a Laravel model caching technique that’s a little more granular using Active Record models.
Using a unique cache key on the model, you can cache properties and associations on your models that are automatically updated (and the cache invalidated) when the model (or associated model) is updated. A side benefit is that accessing the cached data is more portable than caching data in the controller, because it’s on the model instead of within a single controller method.
Here’s the gist of the technique:
Let’s say you have an Article
model that has many Comment
models. Given the following Laravel blade template, you might retrieve the comment count like so on your /article/:id
route:
<h3>$article->comments->count() {{ str_plural('Comment', $article->comments->count())</h3>
You could cache the comment count in the controller, but the controller can get pretty ugly when you have multiple one-off queries and data you need to cache. Using the controller, accessing the cached data isn’t very portable either.
We can build a template that will only hit the database when the article is updated, and any code that has access to the model can grab the cached value:
<h3>$article->cached_comments_count {{ str_plural('Comment', $article->cached_comments_count)</h3>
Using a model accessor, we will cache the comment count based on the last time the article was updated.
So how do we update the article’s updated_at
column when a new comment is added or removed?
Enter the touch method.
Using the model’s touch()
method, we can update an article’s updated_at
column:
$ php artisan tinker
>>> $article = \App\Article::first();
=> App\Article {#746
id: 1,
title: "Hello World",
body: "The Body",
created_at: "2018-01-11 05:16:51",
updated_at: "2018-01-11 05:51:07",
}
>>> $article->updated_at->timestamp
=> 1515649867
>>> $article->touch();
=> true
>>> $article->updated_at->timestamp
=> 1515650910
We can use the updated timestamp to invalidate a cache, but how can we touch the article’s updated_at
field when we add or remove a comment?
It just so happens that Eloquent models have a property called $touches
. Here’s what our comment model might look like:
<?php
namespace App;
use App\Article;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
protected $guarded = [];
protected $touches = ['article'];
public function article()
{
return $this->belongsTo(Article::class);
}
}
The $touches
property is an array containing the association that will get “touched” when a comment is created, saved, or removed.
Let’s go back to the $article->cached_comments_count
accessor. The implementation might look like this on the App\Article
model:
public function getCachedCommentsCountAttribute()
{
return Cache::remember($this->cacheKey() . ':comments_count', 15, function () {
return $this->comments->count();
});
}
We are caching the model for fifteen minutes using a unique cacheKey()
method and simply returning the comment count inside the closure.
Note that we could also use the Cache::rememberForever()
method and rely on our caching mechanism’s garbage collection to remove stale keys. We’ve set a timer so that the cache will be hit most of the time, with a fresh cache every fifteen minutes.
The cacheKey()
method needs to make the model unique, and invalidate the cache when the model is updated. Here’s my cacheKey
implementation:
public function cacheKey()
{
return sprintf(
"%s/%s-%s",
$this->getTable(),
$this->getKey(),
$this->updated_at->timestamp
);
}
The example output for the model’s cacheKey()
method might return the following string representation:
articles/1-1515650910
The key is the name of the table, the model id, and the current updated_at
timestamp. Once we touch the model, the timestamp will be updated, and our model cache will be invalidated appropriately.
Here’s the Article
model if full:
<?php
namespace App;
use App\Comment;
use Illuminate\Support\Facades\Cache;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
public function cacheKey()
{
return sprintf(
"%s/%s-%s",
$this->getTable(),
$this->getKey(),
$this->updated_at->timestamp
);
}
public function comments()
{
return $this->hasMany(Comment::class);
}
public function getCachedCommentsCountAttribute()
{
return Cache::remember($this->cacheKey() . ':comments_count', 15, function () {
return $this->comments->count();
});
}
}
And the associated Comment
model:
<?php
namespace App;
use App\Article;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
protected $guarded = [];
protected $touches = ['article'];
public function article()
{
return $this->belongsTo(Article::class);
}
}
We’ve shown you how to cache a simple comment count, but what about caching all the comments?
public function getCachedCommentsAttribute()
{
return Cache::remember($this->cacheKey() . ':comments', 15, function () {
return $this->comments;
});
}
You might also choose to convert the comments to an array instead of serializing the models to only allow simple array access to the data on the frontend:
public function getCachedCommentsAttribute()
{
return Cache::remember($this->cacheKey() . ':comments', 15, function () {
return $this->comments->toArray();
});
}
Lastly, we defined the cacheKey()
method on the Article
model, but you would want to define this method via a trait called something like ProvidesModelCacheKey
that you can use on multiple models or define the method on a base model that all our models extend. You might even want to use a contract (interface) for models that implement a cacheKey()
method.
Hire Laravel Developer from us, as we give you high quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop custom web app using Laravel, please visit our technology page.
Content Source:
Laravel created a Blade Extension package that allows you to register Blade extension classes in the service container that automatically get registered with the Blade compiler. You can also easily create new Blade extension classes with the provided php artisan make:blade
command (auto-registered package commands FTW).
The concept isn’t revolutionary by any means, but user like how it organizes their project-specific blade extensions into service container classes.
Let’s say, for example, that you have some custom directives around working with a shopping cart. Here’s a quick example of how it might look using Blade Extensions package:
<?php
namespace App\Blade;
use BitPress\BladeExtension\Contracts\BladeExtension;
class CartExtension implements BladeExtension
{
public function getDirectives()
{
return [
'cartcount' => [$this, 'getCartCount']
];
}
public function getConditionals()
{
return [
'cartempty' => [$this, 'isCartEmpty']
];
}
public function getCartCount()
{
// logic to return cart count
}
public function isCartEmpty()
{
// logic for empty cart
}
}
The above extension would provide the following directives in blade:
{{-- Conditional --}}
@cartempty
<p>The cart is empty</p>
@else
<p>The cart is not empty</p>
@endcartempty
{{-- Directive --}}
<span class="count">@cartcount</span>
It’s nothing special – it’s just PHP callables – but user like the feel of a dedicated class that can benefit from injecting services (i.e. a cart service) and keeping these related extensions grouped in one file.
If user need to add additional directives for the shopping cart, all they need to do is update the getDirectives()
method and define the associated callable.
You might find it interesting how this package’s service provider hooks into the Blade compiler. It’s pretty simple: the boot()
method just gets all services tagged with blade.extension
and registers the directives in the compiler.
// In the BladeExtensionServiceProvider::boot() method
foreach ($this->app->tagged('blade.extension') as $extension) {
if (! $extension instanceof BladeExtension) {
throw new InvalidBladeExtension($extension);
}
foreach ($extension->getDirectives() as $name => $callable) {
$this->app['blade.compiler']->directive($name, $callable);
}
foreach ($extension->getConditionals() as $name => $callable) {
$this->app['blade.compiler']->if($name, $callable);
}
}
The Blade Extensions package makes it easy to both create and register blade extensions in the service container:
php artisan make:blade Cart
And this is how you register it (it also tags the service) with the provided BladeRegistrar
class:
use App\Blade\CartExtension;
use BitPress\BladeExtension\Container\BladeRegistrar;
// ...
BladeRegistrar::register(CartExtension::class, function () {
return new CartExtension();
});
You can also use a provided helper method instead if you prefer:
blade_extension(CartExtension::class, function () {
return new CartExtension();
});
Essentially this is what the BladeRegistrar
does for you:
$this->app->singleton(CartExtension::class);
$this->app->tag(CartExtension::class, 'blade.extension');
Hire Laravel Developer from us, as we give you high quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop custom web app using Laravel, please visit our technology page.
Content Source:
Laravel strives to make the entire PHP development experience delightful, including your local development environment. Vagrant provides a simple, elegant way to manage and provision Virtual Machines.
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 7.1, PHP 7.0, PHP 5.6, MySQL, PostgreSQL, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.
Laravel Homestead v6.6.0 was released over the weekend, most notably adding self-signed wildcard SSL certificates and Symfony 4 support.
To upgrade, you first need to update the Vagrant box:
vagrant box update
If you checked out Homestead, next you need to run:
git pull origin master
Or if you have Homestead installed in your project’s composer.json
file with "laravel/homestead"
: "^6"
and then run:
composer update
Here’s the list of important changes and additions in this release:
Hire Laravel Developer from us, as we give you high quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – hello@hkinfosoft.com or Skype us: “hkinfosoft“.
To develop custom web app using Laravel, please visit our technology page.
Content Source:
57 Sherway St,
Stoney Creek, ON
L8J 0J3
606, Suvas Scala,
S P Ring Road, Nikol,
Ahmedabad 380049
1131 Baycrest Drive,
Wesley Chapel,
FL 33544
57 Sherway St,
Stoney Creek, ON
L8J 0J3
606, Suvas Scala,
S P Ring Road, Nikol,
Ahmedabad 380049
1131 Baycrest Drive,
Wesley Chapel,
FL 33544
© 2024 — HK Infosoft. All Rights Reserved.
© 2024 — HK Infosoft. All Rights Reserved.
T&C | Privacy Policy | Sitemap