4

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?

2
  • Provide more information about your question Commented Feb 14, 2020 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
    Commented Feb 14, 2020 at 9:10

2 Answers 2

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.

3
  • 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
    Commented Feb 14, 2020 at 14:18
  • I got the answer @YashPatadia
    – Haerriz
    Commented Feb 14, 2020 at 14:32
  • great :) enjoy coding.. Commented Feb 15, 2020 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"/>
4
  • I tired it but it didn't work out @YoYoRoshan
    – Haerriz
    Commented Feb 14, 2020 at 13:11
  • @Haerriz Can you please Flush the cache: php bin/magento cache:flush Commented Feb 14, 2020 at 13:18
  • Ya I did that. Can you please read my comment on the question. I did the same thing already @YoYoRoshan
    – Haerriz
    Commented Feb 14, 2020 at 13:20
  • @Haerriz can you once try answer posted by #YashPatadia Commented Feb 14, 2020 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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