3

I need my title of the category page to be placed between the number of items and the sort by option. What should I do?

The location where the title has to be

Which container has to be moved to which destination?

  • Provide more information about your question – Ashish Ranade Feb 14 at 9:06
  • i first moved the title from <move element="page.main.title" destination="content" before="category.products"/> but I couldn't place the title between the sortby option and the number of items. @AshishRanade – Haerriz Feb 14 at 9:10
2

Firstly remove title block from your custom frontend/layout/catalog_category_view.xml

<referenceBlock name="page.main.title" remove="true" />

Then this is the file from where you can inject title block vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml make sure to override the file.

Title block is called something like

<block class="Magento\Theme\Block\Html\Title" name="page.main.title" template="Magento_Theme::html/title.phtml"/>

Hope this helps you.

| improve this answer | |
  • I have set using the "set template" like " <?php include ($block->setTemplateFile('Magento_Theme::html/title.phtml')) ?> " but I couldn't get the output. Can you please say how to set the template in it? @YashPatadia – Haerriz Feb 14 at 14:18
  • I got the answer @YashPatadia – Haerriz Feb 14 at 14:32
  • great :) enjoy coding.. – Yash Patadia Feb 15 at 10:59
0

If you want to move the title above content please follow the below steps.

In the folder vendor/magento/module-catalog/view/frontend/layout/ is the file catalog_category_view.xml.

Copy this file to your own theme folder or module folder (if you don't know how to create a theme or a module take a look in the dev docs from Magento).

Add the following line at the end of that file before the closing body tag

<move element="page.main.title" destination="content" before="category.products"/>
| improve this answer | |
  • I tired it but it didn't work out @YoYoRoshan – Haerriz Feb 14 at 13:11
  • @Haerriz Can you please Flush the cache: php bin/magento cache:flush – Yo Yo Roshan Feb 14 at 13:18
  • Ya I did that. Can you please read my comment on the question. I did the same thing already @YoYoRoshan – Haerriz Feb 14 at 13:20
  • @Haerriz can you once try answer posted by #YashPatadia – Yo Yo Roshan Feb 14 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.