20

Call your contact form block with template file in the cms pages. Try below code : {{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}


15

There are no registry variable add at cms page. So, if you want to check a page is CMS page then you need to check current controller and action name means Full action name Best practices In Magento2, every block has request Object ,So you can get current page full action name via $block->getRequest()->getFullActionName(); Code: $...


14

First you have to create your own module to override the save action and dataProvider for cms page. If you don't know how to create module Please refer this link http://inchoo.net/magento-2/how-to-create-a-basic-module-in-magento-2/. After creating a module, follow the following steps: Step 1. Add column for custom image on cms_page table Create ...


13

By using object manager you can get CMS page url, if you have already id of cms page. $pageId = 1; $this->_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); or $this->_objectManager = $block->_objectManager; $CMSPageURL = $this->_objectManager->create('Magento\Cms\Helper\Page') ->getPageUrl($pageId); you can call ...


12

Let's say the block that displays your content is called Vendor\Module\Block\Entity. Add a dependency Zend_Filter_Interface to your block like this: protected $templateProcessor; public function __construct( ... \Zend_Filter_Interface $templateProcessor, ..... ) { .... $this->templateProcessor = $templateProcessor; .... } Then ...


12

copy file from vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml and put this file in your theme location app/design/frontend/Vendor/YourTheme/Magento_Theme/templates/html/topmenu.phtml Add below <li> structure just after <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?> line in topmenu.phtml <li ...


12

You can create a custom CMS page layout file by using this below way. File name should be like this : cms_page_view_selectable_<CMS Page Identifier>_<Layout Update Name>.xml => For eg : If your cms page identifier is customhome, then file name should be cms_page_view_selectable_customhome_customhomelayout.xml https://devdocs.magento.com/guides/...


11

First, you need to add the files inside your project so magento can display them on the back office There is two ways : The simplier way : just add your file via ftp to media/wysiwyg/[optional_folders]/[your_file.pdf]. OR Make magento allow pdf files upload on back office. There's two steps : Add pdf to allowed extensions type. With that modification ...


9

you are getting that url because the homepage is a CMS page. In your case it has the identifier home. In order to change that url you need to rewrite the method Mage_Sitemap_Model_Resource_Cms_Page::_prepareObject and make it look like this: protected function _prepareObject(array $data) { $object = new Varien_Object(); $object->setId($data[$this-...


9

You can use in Magento 2 like this {{block class="Magento\Framework\View\Element\Template" name="blockname" template="Vendor_Module::test.phtml" my_vars="123,456"}} Now you can get the data by calling: $myVar = $block->getData('my_vars'); OR $myVar = $block->getMyVars(); Note: You should use $block instead of $this


9

Another alternative is to use a new template file via layout xml. ./app/design/frontend/Company/Yourtheme/Magento_Theme/layout/default.xml <?xml version="1.0"?> <!-- /** * Copyright info. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/...


8

you can customize (404) page from admin Content->Pages->404 Not Found->Edit->content here you can change whatever content you need. If you look programmatically solution, add the below content in your <root-magent>/app/code/Vendor/Module/etc/di.xml <type name="Magento\Framework\App\Router\NoRouteHandlerList"> <arguments> ...


8

You can do this by two ways as described below. First create the custom.js at below location (in your case you have already did this) app/design/{Vendor_name}/{theme}/web/js/custom.js Now you can choose any of the below steps for your requirement. 1st Way Just traverse to the below location Admin > Content > Elements > Pages > Design > Layout ...


7

protected $responseFactory; protected $url; public function __construct( ... \Magento\Framework\App\ResponseFactory $responseFactory, \Magento\Framework\UrlInterface $url ... ) { $this->responseFactory = $responseFactory; $this->redirect = $redirect; $this->url = $url; } public function execute(\Magento\Framework\Event\...


7

Please use below code for link in static page <a href="{{config path="web/unsecure/base_url"}}<<YOUR CATEGORY URL KEY>>" target="_self"><img src="{{media url="wysiwyg/clothing.png"}}" alt="" width="IMGWIDTH" height="IMGHEIGHT" /></a> OR <a href="{{store url='YOUR CATEGORY URL KEY'}}" target="_self"><img src="{{...


7

Try to use below code in your .phtml file <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $request = $objectManager->get('\Magento\Framework\App\Request\Http'); $checkModule = $request->getModuleName(); if($checkModule == 'cms'){ echo "cms page"; }else{ echo "not cms page"; } ?>


7

Answer given a base on Magento 2.3.1 Opensource There are 3 files, the Sitemap related data of Products, Categories, and CMS Pages is coming Magento\Sitemap\Model\ResourceModel\Catalog\Category:getCollection() Magento\Sitemap\Model\ResourceModel\Catalog\Product:getCollection() Magento\Sitemap\Model\ResourceModel\Cms\Page:getCollection() So, you want to ...


6

Open your admin panel of magento. Goto System>Configuration>>Web> URL Option and change Auto-redirect to Base URL to No.


6

you can add set setTimeout <script type="text/javascript"> function scr(){ window.location = "http://www.yoururl.com"; } setTimeout(scr,10000); </script>


6

Create Vendor/Module/view/adminhtml/ui_component/cms_page_form.xml <?xml version="1.0" encoding="UTF-8"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <fieldset name="general"> <field name="identifier_test"> <argument ...


6

If you want to call static block in page in magento 2 Try this below code : {{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}} If you want to call in phtml file : Try this below code : <?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?> Your xml ...


6

Here is an example how to insert cms data in m2 Here is an example how to update cms data in m2 Now you can try following way for insert cms data: public function __construct( \Magento\Cms\Model\PageFactory $pageFactory ) { $this->pageFactory = $pageFactory; } And now: $cmsPage = [ 'title' => 'TEST TITLE', 'identifier' => 'test-content-1'...


6

Magento 2 Edit CMS page to show go to Admin >> Contents >> CMS By default CMS page Admin >> Stores >> Configuration >> General >> Web >> Default Pages >> As u select CMS as a by default


5

You can use the following code in the content area of the CMS page: {{block type="core/template" template="mw/news/slider.phtml"}} If needed you can replace 'core/template' with another custom block type. You can't use a custom .phtml template when adding a widget, so inserting the block directly is the right way to do it.


5

You can add Layout Update XML update GOTO ADMIN -> Content -> Pages -> Edit page -> Design -> Layout Update XML With the content : <head> <css src="Namespace_YourModule::css/styles.css"/> </head> Then there is a bug in Magento 2, you need to override the default Magento 2 vendor/magento/framework/View/Layout/etc/...


5

Add following code in your Block class, here Form class is an example <?php namespace Vendor\Module\Block; class Form extends \Magento\Framework\View\Element\Template { /** * @var \Magento\Cms\Model\Template\FilterProvider */ protected $_filterProvider; /** * @var \Magento\Cms\Model\Page */ protected $_page; /** ...


5

Both in the database: blocks in cms_block table pages in cms_page table Please note that Magento also stores the relationship between those and the store ids in the following tables: cms_block_store cms_page_store


5

Put your js file in your custom module Vendor_Module/view/frontend/web/js/yourjsfile Create requirejs-config.js file in your custom_module/view/frontend. add below code in it . var config = { "map": { "*": { "instapic": "Vendor_Module/js/instapic-slider" } } }; Now call the js file in your .phtml template file by ...


5

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}


5

You can try this : <script> require([ 'jquery' ], function ($) { $(".home-banner").insertBefore(".page-main"); }); </script>


Only top voted, non community-wiki answers of a minimum length are eligible