Magento 2 Call phtml file in CMS Page

Here we will learn how to call custom phtml file on any cms page or add phtml in your custom cms page.

First, go to the admin section and open CMS page in which you want to add phtml file.
Go to the content section and add blow code.
Note: Replace package and module with your custom module.

{{block class="Magento\Framework\View\Element\Template" template="Package_Module::test.phtml"}}

Are you want to add external CSS in cms page?
You just need to put below code in cms page->design tab->layout section.



Afer save CMS page clear cache.

Magento 2 Useful Commands

Forusefully deploy

php bin/magento setup:static-content:deploy -f -s standard

Setup Upgrade Using Command Line

php bin/magento setup:upgrade

If you don’t want to remove pub/static files while installing/updating database then use following command.

php bin/magento setup:upgrade --keep-generated

Cache Clean Using Command Line

php bin/magento cache:clean

Cache Flush Using Command Line

php bin/magento cache:flush

View cache status Using Command Line

php bin/magento cache:status

Enable Cache Using Command Line

php bin/magento cache:enable [cache_type]

Disable Cache Using Command Line

php bin/magento cache:disable [cache_type]

Static Content Deploy Using Command Line (Use -f for force deploy on 2.2.x or later)

php bin/magento setup:static-content:deploy

Static Content Deploy For Particular Language Using Command Line

php bin/magento setup:static-content:deploy en_US

Static Content Deploy For Magento Backend Theme Using Command Line (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy --theme="Magento/backend"

Static Content Deploy For Specific Themes Using Command Line (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/second_theme

Exclude Themes on Static Content Deploy and does not minify HTML files Using Command Line (Working on 2.1.1 or later)

php bin/magento setup:static-content:deploy en_US --exclude-theme Magento/luma --no-html-minify

Reindexing Using Command Line

php bin/magento indexer:reindex

View the list of indexers Using Command Line

php bin/magento indexer:info

View indexer status Using Command Line

php bin/magento indexer:status

Show the mode of all indexers Using Command Line

php bin/magento indexer:show-mode

See all modules Status Using Command Line

php bin/magento module:status

Enable module Using Command Line

php bin/magento module:enable Namespace_Module

Disable module Using Command Line

php bin/magento module:disable Namespace_Module

Uninstall Module Using Command Line

php bin/magento module:uninstall Namespace_Module

Check Current Mode Using Command Line

php bin/magento deploy:mode:show

Change To Developer Mode Using Command Line

php bin/magento deploy:mode:set developer

Change To Production Mode Using Command Line

php bin/magento deploy:mode:set production

Run the single-tenant Compiler Using Command Line

php bin/magento setup:di:compile

Unlock Admin User Using Command Line

Unlock Admin User Using Command Line

Enable Maintenance Mode Using Command Line

php bin/magento maintenance:enable

Class Authorization GroupFactory Model does not exist magento2

Getting error Class Magento\Authorization\Model\Acl\Role\GroupFactory does not exist

Magento 2 is quite complex to understand. We frequently get this error while developing the store. Here is the solution to fix this error.

1) go to the var folder and find generation. now remove the folder.

2) Now run below code using the command line

php bin/magento setup:di:compile

It will automatically create all folder in the generation folder.

3) Then clear cache using below code:

php bin/magento cache:flush

Now, Run your store it will run without error.