In this post, I will guide you on How To Add Top Link In Magento 2. Use the header of the website to deploy advertising campaigns, gratitude for the store’s customers. Show The header of the website is the location that attracts a lot of attention, this is an ideal place to place important events, promotional campaigns, shopping, gratitude for your customers. Adding a link at the top of the page will make it easier for customers to reach it. The difference between header and top link is:
1. Create default.xml file in the following path: app\code{your-Vendor}{your-Extension}\view\frontend\layout\default.xml 2. And add the following code: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> </body>
</page>You substitute the values below according to your need:
3. Then, run deploy static content, flush cache command and see the result: php bin/magento setup:static-content:deploy -f php bin/magento cache:flush Follow us for the more helpful posts! We hope this is a useful post for you. You can read more useful posts like How To Change Order Increment ID Length In Magento 2. Thank you for reading! 4.8 4 votes Article Rating Aaron LXAaron is a passionate writer, crazy about shopping, eCommerce and trends. Besides his outstanding research skills and a positive mind, Aaron eagerly shares his experience with the readers. In this blog I will explain how to add header and top link with default.xml file. Header link is displayed for both guest and logged in customers. Top link is displayed only for logged in users. To show the links create default.xml under Webkul/Menu/view/frontend/layout folder <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> </page>For guest customer, For Logged in customer, Check out the following blogs regarding links, Searching for an experienced Magento 2 Company ? Find out More Add Custom Block and Link Header in Magento 2 How to add custom link in navigation menu in Magento2 Magento2 – Add New Link in My Account Navigation Panel call custom block and links in footer in magento 2 Feel free to comment if any issue occurs. Sanjay Chouhan
View More How to add a custom header link in Magento 2?How to Add Custom Header Links in Magento 2?. Create a custom module based on Magento 2 structure in the folder app/code. ... . Create module. ... . Create routes. ... . Create layout file in the below path for a custom header. ... . Create block file that is referred to in the layout file in the below path.. How do I add a top link in Magento 2?Create Custom Magento 2 Module xml file at app/code/Demo/Toplink/etc. file path and add the below code in the file. Then, create registration. php in app/code/Demo/Toplink file path and add the following code to it. How to create custom top menu in Magento 2?How to Add Custom Admin Menu In Magento 2. Step 1: Create the file registration.php.. Step 2: Create file module.xml.. Step 3: Create file menu.xml.. Step 4: Create file routes.xml.. Step 5: Create a New Menu Item.. Step 6: Clear Magento Cache.. Final Words!. How to create custom URL in Magento 2?You can create different URLs for a single page by using URL rewrites:. Go to the Magento 2 admin panel and navigate to Marketing > SEO & Search > URL Rewrites.. Click on the "Add URL Rewrite" button to create a new rewrite.. Select "Custom" as the URL Rewrite Type.. Select the Store you want to apply this rewrite to.. |