{"id":322845,"date":"2022-02-18T19:37:20","date_gmt":"2022-02-18T19:37:20","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=322845"},"modified":"2024-07-26T07:08:18","modified_gmt":"2024-07-26T07:08:18","slug":"layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/","title":{"rendered":"Layered navigation for custom collection on a custom page in Magento 2"},"content":{"rendered":"\n<p>Hello Friends!!!<\/p>\n\n\n\n<p>In this blog, we are going to learn how we can create based on <a href=\"https:\/\/store.webkul.com\/magento2-layered-navigation.html\">Magento 2 layered navigation<\/a> for our custom collection on a custom page.<\/p>\n\n\n\n<p>Sometimes, when we create a custom collection page in our module, we extend the <em>\\Magento\\Catalog\\Block\\Product\\ListProduct<\/em> class and apply the filters in collection for our custom collection and it works.<\/p>\n\n\n\n<p>But sometimes, we face wrong product count or pagination issues, or layered navigation issues on our custom collection page.<\/p>\n\n\n\n<p>So, here I will explain in following steps to achieve the correct result for the custom collection page with the toolbar and layered navigation.<\/p>\n\n\n\n<p><strong>Step 1: Create di.xml file inside the app\/code\/Webkul\/MyCustomCollection\/etc\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;!--\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n--&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;..\/..\/..\/..\/..\/lib\/internal\/Magento\/Framework\/ObjectManager\/etc\/config.xsd&quot;&gt;\n\t&lt;!-- here custom layer class extends the default Magento layer class.\n\t\t That class instantiates a number of interfaces. --&gt;\n\t&lt;preference for=&quot;Magento\\Catalog\\Model\\Layer\\ContextInterface&quot; type=&quot;Magento\\Catalog\\Model\\Layer\\Context&quot; \/&gt;\n\t&lt;preference for=&quot;Magento\\Catalog\\Model\\Layer\\ItemCollectionProviderInterface&quot; type=&quot;Magento\\Catalog\\Model\\Layer\\Category\\ItemCollectionProvider&quot; \/&gt;\n\t&lt;preference for=&quot;Magento\\Catalog\\Model\\Layer\\StateKeyInterface&quot; type=&quot;Magento\\Catalog\\Model\\Layer\\Category\\StateKey&quot; \/&gt;\n\t&lt;preference for=&quot;Magento\\Catalog\\Model\\Layer\\CollectionFilterInterface&quot; type=&quot;Magento\\Catalog\\Model\\Layer\\Category\\CollectionFilter&quot; \/&gt;\n\t&lt;preference for=&quot;Magento\\Catalog\\Model\\Layer\\FilterableAttributeListInterface&quot; type=&quot;Magento\\Catalog\\Model\\Layer\\Category\\FilterableAttributeList&quot; \/&gt;\n\t&lt;preference for=&quot;Magento\\Catalog\\Model\\Layer\\AvailabilityFlagInterface&quot; type=&quot;Magento\\Catalog\\Model\\Layer\\Category\\AvailabilityFlag&quot; \/&gt;\n    \n    &lt;preference for=&quot;Magento\\Catalog\\Model\\ResourceModel\\Category&quot; type=&quot;Webkul\\MyCustomCollection\\Model\\ResourceModel\\Category&quot; \/&gt;\n    &lt;preference for=&quot;Magento\\Catalog\\Model\\ResourceModel\\Layer\\Filter\\Price&quot; type=&quot;Webkul\\MyCustomCollection\\Model\\ResourceModel\\Layer\\Filter\\Price&quot; \/&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p><strong>Step 2: Now, create Model files to override the collection data. Here, we will create Layer.php file inside the app\/code\/Webkul\/MyCustomCollection\/Model\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Model;\n\nclass Layer extends \\Magento\\Catalog\\Model\\Layer\n{\n\tpublic function getProductCollection()\n\t{\n\t\t$collection = parent::getProductCollection();\n\t\t$collection-&gt;addAttributeToFilter(&#039;deal_status&#039;, &#091;&#039;eq&#039; =&gt; &#039;1&#039;]);\n\t\t$idArray = &#091;1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];\n\t\tif (!empty($idArray)) {\n            $collection-&gt;addAttributeToFilter(&#039;entity_id&#039;, &#091;&quot;in&quot;=&gt;$idArray]);\n        }\n\t\treturn $collection;\n\t}\n}<\/pre>\n\n\n\n<p><strong>Now, we will create Resolver.php file inside the app\/code\/Webkul\/MyCustomCollection\/Model\/Layer directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Model\\Layer;\n\nclass Resolver extends \\Magento\\Catalog\\Model\\Layer\\Resolver\n{\n\tpublic function __construct(\n\t\t\\Magento\\Framework\\ObjectManagerInterface $objectManager,\n\t\t\\Webkul\\MyCustomCollection\\Model\\Layer $layer,\n\t\tarray $layersPool\n\t) {\n\t\t$this-&gt;layer = $layer;\n\t\tparent::__construct($objectManager, $layersPool);\n\t}\n\n\tpublic function create($layerType)\n\t{\n\t\t\/\/$this-&gt;layer gets set in the constructor, so this create function\n\t\t\/\/doesn&#039;t need to do anything.\n\t}\n}<\/pre>\n\n\n\n<p><strong>Now, we will create Category.php file inside the app\/code\/Webkul\/MyCustomCollection\/Model\/ResourceModel\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Model\\ResourceModel;\n\nclass Category extends \\Magento\\Catalog\\Model\\ResourceModel\\Category\n{\n    public function getProductCount($category)\n    {\n        $collection = $category-&gt;getProductCollection();\n        $collection-&gt;addAttributeToFilter(&#039;deal_status&#039;, &#091;&#039;eq&#039; =&gt; &#039;1&#039;]);\n\t\t$idArray = &#091;1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];\n\t\tif (!empty($idArray)) {\n            $collection-&gt;addAttributeToFilter(&#039;entity_id&#039;, &#091;&quot;in&quot;=&gt;$idArray]);\n        }\n        return intval($collection-&gt;count());\n    }\n}<\/pre>\n\n\n\n<p><strong>Now, we will create Price.php file inside the app\/code\/Webkul\/MyCustomCollection\/Model\/ResourceModel\/Layer\/Filter directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Model\\ResourceModel\\Layer\\Filter;\n\nclass Price extends \\Magento\\Catalog\\Model\\ResourceModel\\Layer\\Filter\\Price\n{\n    \/**\n     * @param \\Magento\\Framework\\Model\\ResourceModel\\Db\\Context $context\n     * @param \\Magento\\Framework\\Event\\ManagerInterface $eventManager\n     * @param \\Magento\\Catalog\\Model\\Layer\\Resolver $layerResolver\n     * @param \\Magento\\Customer\\Model\\Session $session\n     * @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n     * @param \\Webkul\\MyCustomCollection\\Model\\Layer $layer\n     * @param null $connectionName\n     *\/\n    public function __construct(\n        \\Magento\\Framework\\Model\\ResourceModel\\Db\\Context $context,\n        \\Magento\\Framework\\Event\\ManagerInterface $eventManager,\n        \\Magento\\Catalog\\Model\\Layer\\Resolver $layerResolver,\n        \\Magento\\Customer\\Model\\Session $session,\n        \\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n        \\Webkul\\MyCustomCollection\\Model\\Layer $layer,\n        $connectionName = null\n        ) {\n            $this-&gt;layer        = $layerResolver-&gt;get();\n            $this-&gt;session      = $session;\n            $this-&gt;storeManager = $storeManager;\n            parent::__construct(\n                $context,\n                $eventManager,\n                $layerResolver,\n                $session,\n                $storeManager,\n                $connectionName\n            );\n    }\n    \n    public function getCount($range)\n    {\n        $select = $this-&gt;getSelect();\n        $priceExpression = $this-&gt;_getFullPriceExpression($select);\n\n        \/**\n         * Check and set correct variable values to prevent SQL-injections\n         *\/\n        $range = floatval($range);\n        if ($range == 0) {\n            $range = 1;\n        }\n        $countExpr = new \\Zend_Db_Expr(&#039;COUNT(*)&#039;);\n        $rangeExpr = new \\Zend_Db_Expr(&quot;FLOOR(({$priceExpression}) \/ {$range}) + 1&quot;);\n\n        $select-&gt;columns(&#091;&#039;range&#039; =&gt; $rangeExpr, &#039;count&#039; =&gt; $countExpr]);\n        $select-&gt;group($rangeExpr)-&gt;order(new \\Zend_Db_Expr(&quot;({$rangeExpr}) ASC&quot;));\n        \n        return $this-&gt;getConnection()-&gt;fetchPairs($select);\n    }\n    \n    public function getSelect()\n    {\n        $collection = $this-&gt;layer-&gt;getProductCollection();\n        $collection-&gt;addAttributeToFilter(&#039;deal_status&#039;, &#091;&#039;eq&#039; =&gt; &#039;1&#039;]);\n\t\t$idArray = &#091;1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];\n\t\tif (!empty($idArray)) {\n            $collection-&gt;addAttributeToFilter(&#039;entity_id&#039;, &#091;&quot;in&quot;=&gt;$idArray]);\n        }\n        $collection-&gt;addPriceData(\n            $this-&gt;session-&gt;getCustomerGroupId(),\n            $this-&gt;storeManager-&gt;getStore()-&gt;getWebsiteId()\n        );\n        \n        $select = clone $collection-&gt;getSelect();\n        \/\/ reset columns, order and limitation conditions\n        $select-&gt;reset(\\Magento\\Framework\\DB\\Select::COLUMNS);\n        $select-&gt;reset(\\Magento\\Framework\\DB\\Select::ORDER);\n        $select-&gt;reset(\\Magento\\Framework\\DB\\Select::LIMIT_COUNT);\n        $select-&gt;reset(\\Magento\\Framework\\DB\\Select::LIMIT_OFFSET);\n        \n        \/\/ remove join with main table\n        $fromPart = $select-&gt;getPart(\\Magento\\Framework\\DB\\Select::FROM);\n        if (!isset(\n            $fromPart&#091;\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection::INDEX_TABLE_ALIAS]\n        ) || !isset(\n            $fromPart&#091;\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection::MAIN_TABLE_ALIAS]\n            )\n        ) {\n            return $select;\n        }\n        \n        \/\/ processing FROM part\n        $priceIndexJoinPart = $fromPart&#091;\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection::INDEX_TABLE_ALIAS];\n        $priceIndexJoinConditions = explode(&#039;AND&#039;, $priceIndexJoinPart&#091;&#039;joinCondition&#039;]);\n        $priceIndexJoinPart&#091;&#039;joinType&#039;] = \\Magento\\Framework\\DB\\Select::FROM;\n        $priceIndexJoinPart&#091;&#039;joinCondition&#039;] = null;\n        $fromPart&#091;\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection::MAIN_TABLE_ALIAS] = $priceIndexJoinPart;\n        unset($fromPart&#091;\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection::INDEX_TABLE_ALIAS]);\n        $select-&gt;setPart(\\Magento\\Framework\\DB\\Select::FROM, $fromPart);\n        foreach ($fromPart as $key =&gt; $fromJoinItem) {\n            $fromPart&#091;$key]&#091;&#039;joinCondition&#039;] = $this-&gt;_replaceTableAlias($fromJoinItem&#091;&#039;joinCondition&#039;]);\n        }\n        $select-&gt;setPart(\\Magento\\Framework\\DB\\Select::FROM, $fromPart);\n        \n        \/\/ processing WHERE part\n        $wherePart = $select-&gt;getPart(\\Magento\\Framework\\DB\\Select::WHERE);\n        foreach ($wherePart as $key =&gt; $wherePartItem) {\n            $wherePart&#091;$key] = $this-&gt;_replaceTableAlias($wherePartItem);\n        }\n        $select-&gt;setPart(\\Magento\\Framework\\DB\\Select::WHERE, $wherePart);\n        $excludeJoinPart = \\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection::MAIN_TABLE_ALIAS . &#039;.entity_id&#039;;\n        foreach ($priceIndexJoinConditions as $condition) {\n            if (strpos($condition, $excludeJoinPart) !== false) {\n                continue;\n            }\n            $select-&gt;where($this-&gt;_replaceTableAlias($condition));\n        }\n        $select-&gt;where($this-&gt;_getPriceExpression($select) . &#039; IS NOT NULL&#039;);\n        \n        return $select;\n    }\n}<\/pre>\n\n\n\n<p><strong>Step 3: Create layout file mycollection_index_index.xml inside the app\/code\/Webkul\/MyCustomCollection\/view\/frontend\/layout\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;!--\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyMyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n--&gt;\n&lt;page xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; layout=&quot;2columns-left&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&quot;&gt;\n\t&lt;body&gt;\n\t\t&lt;!--adding attribute tag to inherit the default stying for products--&gt;\n\t\t&lt;attribute name=&quot;class&quot; value=&quot;page-products&quot;\/&gt;\n\t\t&lt;referenceContainer name=&quot;content&quot;&gt;\n\t\t\t&lt;block class=&quot;Webkul\\MyCustomCollection\\Block\\Product\\ListProduct&quot; name=&quot;mycollection_index_index&quot; as=&quot;product_list&quot; template=&quot;Magento_Catalog::product\/list.phtml&quot;&gt;\n\t\t\t\t&lt;container name=&quot;category.product.list.additional&quot; as=&quot;additional&quot; \/&gt;\n\t\t\t\t&lt;block class=&quot;Magento\\Framework\\View\\Element\\RendererList&quot; name=&quot;category.product.type.details.renderers&quot; as=&quot;details.renderers&quot;&gt;\n\t\t\t\t\t&lt;block class=&quot;Magento\\Framework\\View\\Element\\Template&quot; name=&quot;category.product.type.details.renderers.default&quot; as=&quot;default&quot;\/&gt;\n\t\t\t\t&lt;\/block&gt;\n\t\t\t\t&lt;block class=&quot;Magento\\Catalog\\Block\\Product\\ProductList\\Item\\Container&quot; name=&quot;category.product.addto&quot; as=&quot;addto&quot;&gt;\n\t\t\t\t\t&lt;block class=&quot;Magento\\Catalog\\Block\\Product\\ProductList\\Item\\AddTo\\Compare&quot;\n\t\t\t\t\t\tname=&quot;category.product.addto.compare&quot; as=&quot;compare&quot;\n\t\t\t\t\t\ttemplate=&quot;Magento_Catalog::product\/list\/addto\/compare.phtml&quot;\/&gt;\n\t\t\t\t&lt;\/block&gt;\n\t\t\t\t&lt;block class=&quot;Magento\\Catalog\\Block\\Product\\ProductList\\Toolbar&quot; name=&quot;product_list_toolbar&quot; template=&quot;Magento_Catalog::product\/list\/toolbar.phtml&quot;&gt;\n\t\t\t\t\t&lt;block class=&quot;Magento\\Theme\\Block\\Html\\Pager&quot; name=&quot;product_list_toolbar_pager&quot;\/&gt;\n\t\t\t\t&lt;\/block&gt;\n\t\t\t\t&lt;action method=&quot;setToolbarBlockName&quot;&gt;\n\t\t\t\t\t&lt;argument name=&quot;name&quot; xsi:type=&quot;string&quot;&gt;product_list_toolbar&lt;\/argument&gt;\n\t\t\t\t&lt;\/action&gt;\n\t\t\t&lt;\/block&gt;\n\t\t&lt;\/referenceContainer&gt;\n\t\t&lt;referenceContainer name=&quot;sidebar.main&quot;&gt;\n\t\t&lt;block class=&quot;Webkul\\MyCustomCollection\\Block\\Navigation&quot; name=&quot;catalog.leftnav&quot; as=&quot;navigation&quot; before=&quot;-&quot; template=&quot;Magento_LayeredNavigation::layer\/view.phtml&quot;&gt;\n\t\t\t\t&lt;block class=&quot;Webkul\\MyCustomCollection\\Block\\Navigation\\State&quot; name=&quot;catalog.navigation.state&quot; as=&quot;state&quot; template=&quot;Magento_LayeredNavigation::layer\/state.phtml&quot; \/&gt;\n\t\t\t\t&lt;block class=&quot;Magento\\LayeredNavigation\\Block\\Navigation\\FilterRenderer&quot; name=&quot;catalog.navigation.renderer&quot; as=&quot;renderer&quot; template=&quot;Magento_LayeredNavigation::layer\/filter.phtml&quot;&gt;\n\t\t\t\t\t&lt;arguments&gt;\n\t\t\t\t\t\t&lt;argument name=&quot;product_layer_view_model&quot; xsi:type=&quot;object&quot;&gt;Magento\\LayeredNavigation\\ViewModel\\Layer\\Filter&lt;\/argument&gt;\n\t\t\t\t\t&lt;\/arguments&gt;\n\t\t\t\t&lt;\/block&gt;\n\t\t\t&lt;\/block&gt;\n\t\t&lt;\/referenceContainer&gt;\n\t\t&lt;referenceBlock name=&quot;mycollection_index_index&quot;&gt;\n\t\t\t&lt;arguments&gt;\n\t\t\t\t&lt;argument name=&quot;viewModel&quot; xsi:type=&quot;object&quot;&gt;Magento\\Catalog\\ViewModel\\Product\\OptionsData&lt;\/argument&gt;\n\t\t\t&lt;\/arguments&gt;\n\t\t&lt;\/referenceBlock&gt;\n\t&lt;\/body&gt;\n&lt;\/page&gt;<\/pre>\n\n\n\n<p><strong>Step 4: Now, we will override the block files to get the required data.<br>Here, we will create Navigation.php file inside the app\/code\/Webkul\/MyCustomCollection\/Block\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Block;\n\nclass Navigation extends \\Magento\\LayeredNavigation\\Block\\Navigation\n{\n\tpublic function __construct(\n\t\t\\Magento\\Framework\\View\\Element\\Template\\Context $context,\n\t\t\\Webkul\\MyCustomCollection\\Model\\Layer\\Resolver $layerResolver,\n\t\t\\Magento\\Catalog\\Model\\Layer\\FilterList $filterList,\n\t\t\\Magento\\Catalog\\Model\\Layer\\AvailabilityFlagInterface $visibilityFlag,\n\t\tarray $data = &#091;]\n\t) {\n\t\tparent::__construct(\n\t\t\t$context,\n\t\t\t$layerResolver,\n\t\t\t$filterList,\n\t\t\t$visibilityFlag\n\t\t);\n\t}\n}\n?&gt;<\/pre>\n\n\n\n<p><strong>Then, create State.php file inside the app\/code\/Webkul\/MyCustomCollection\/Block\/Navigation\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Block\\Navigation;\n\nclass State extends \\Magento\\LayeredNavigation\\Block\\Navigation\\State\n{\n\tpublic function __construct(\n\t\t\\Magento\\Framework\\View\\Element\\Template\\Context $context,\n\t\t\\Webkul\\MyCustomCollection\\Model\\Layer\\Resolver $layerResolver,\n\t\tarray $data = &#091;]\n\t) {\n\t\tparent::__construct(\n\t\t\t$context,\n\t\t\t$layerResolver,\n\t\t\t$data\n\t\t);\n\t}\n}<\/pre>\n\n\n\n<p><strong>Create ListProduct.php file inside the app\/code\/Webkul\/MyCustomCollection\/Block\/Product\/ directory.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_MyCustomCollection\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\MyCustomCollection\\Block\\Product;\n\nclass ListProduct extends \\Magento\\Catalog\\Block\\Product\\ListProduct\n{\n\tpublic function __construct(\n\t\t\\Magento\\Catalog\\Block\\Product\\Context $context,\n\t\t\\Magento\\Framework\\Data\\Helper\\PostHelper $postDataHelper,\n\t\t\\Webkul\\MyCustomCollection\\Model\\Layer\\Resolver $layerResolver,\n\t\t\\Magento\\Catalog\\Api\\CategoryRepositoryInterface $categoryRepository,\n\t\t\\Magento\\Framework\\Url\\Helper\\Data $urlHelper,\n\t\tarray $data = &#091;]\n\t) {\n\t\tparent::__construct(\n\t\t\t$context,\n\t\t\t$postDataHelper,\n\t\t\t$layerResolver,\n\t\t\t$categoryRepository,\n\t\t\t$urlHelper,\n\t\t\t$data\n\t\t);\n\t}\n}<\/pre>\n\n\n\n<p>Now, check the result on the front end. For reference, please look into the following image:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"937\" height=\"1024\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png\" alt=\"192.168.15.170_mage243_pub_mycollection_index_index_\" class=\"wp-image-322852\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png 937w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-275x300.png 275w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-228x249.png 228w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-768x839.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-1406x1536.png 1406w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-1874x2048.png 1874w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_.png 1920w\" sizes=\"(max-width: 937px) 100vw, 937px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>For a better understanding of layered-navigation related classes, please check <a href=\"https:\/\/gist.github.com\/ProcessEight\/b7c242a7177c455efbd076ca0cf06bef\" target=\"_blank\" rel=\"noreferrer noopener\">&#8220;Anatomy of Magento 2: Layered Navigation&#8221;<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/khushboowebkul\/customcollection-with-layered-navigation\" target=\"_blank\" rel=\"noreferrer noopener\">Download the code.<\/a><br><br>Hope this will be helpful. Thanks \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends!!! In this blog, we are going to learn how we can create based on Magento 2 layered navigation for our custom collection on a custom page. Sometimes, when we create a custom collection page in our module, we extend the \\Magento\\Catalog\\Block\\Product\\ListProduct class and apply the filters in collection for our custom collection and <a href=\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":249,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121],"tags":[12414,12415,1698,12410,7943,12413,12411,12412],"class_list":["post-322845","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-create-layered-navigation-on-custom-page","tag-custom-collection","tag-layered-navigation","tag-layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2","tag-layered-navigation-for-custom-page","tag-layered-navigation-issue-in-custom-collection","tag-product-count-is-wrong-in-custom-collection","tag-toolbar-issue-in-custom-collection"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>magento 2 Layered navigation<\/title>\n<meta name=\"description\" content=\"Layered navigation for custom collection on a custom page in Magento 2, how we can create based on Magento 2 layered navigation for our custom collection on a custom page.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"magento 2 Layered navigation\" \/>\n<meta property=\"og:description\" content=\"Layered navigation for custom collection on a custom page in Magento 2, how we can create based on Magento 2 layered navigation for our custom collection on a custom page.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-18T19:37:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-26T07:08:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png\" \/>\n<meta name=\"author\" content=\"Khushboo Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khushboo Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\"},\"author\":{\"name\":\"Khushboo Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\"},\"headline\":\"Layered navigation for custom collection on a custom page in Magento 2\",\"datePublished\":\"2022-02-18T19:37:20+00:00\",\"dateModified\":\"2024-07-26T07:08:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\"},\"wordCount\":315,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png\",\"keywords\":[\"create layered navigation on custom page\",\"Custom Collection\",\"Layered Navigation\",\"Layered navigation for custom collection on a custom page in Magento 2\",\"layered navigation for custom page\",\"layered navigation issue in custom collection\",\"product count is wrong in custom collection\",\"toolbar issue in custom collection\"],\"articleSection\":[\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\",\"name\":\"magento 2 Layered navigation\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png\",\"datePublished\":\"2022-02-18T19:37:20+00:00\",\"dateModified\":\"2024-07-26T07:08:18+00:00\",\"description\":\"Layered navigation for custom collection on a custom page in Magento 2, how we can create based on Magento 2 layered navigation for our custom collection on a custom page.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_.png\",\"width\":1920,\"height\":2098,\"caption\":\"192.168.15.170_mage243_pub_mycollection_index_index_\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Layered navigation for custom collection on a custom page in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\",\"name\":\"Khushboo Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Khushboo Sahu\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"magento 2 Layered navigation","description":"Layered navigation for custom collection on a custom page in Magento 2, how we can create based on Magento 2 layered navigation for our custom collection on a custom page.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"magento 2 Layered navigation","og_description":"Layered navigation for custom collection on a custom page in Magento 2, how we can create based on Magento 2 layered navigation for our custom collection on a custom page.","og_url":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2022-02-18T19:37:20+00:00","article_modified_time":"2024-07-26T07:08:18+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png","type":"","width":"","height":""}],"author":"Khushboo Sahu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Khushboo Sahu","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/"},"author":{"name":"Khushboo Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca"},"headline":"Layered navigation for custom collection on a custom page in Magento 2","datePublished":"2022-02-18T19:37:20+00:00","dateModified":"2024-07-26T07:08:18+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/"},"wordCount":315,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png","keywords":["create layered navigation on custom page","Custom Collection","Layered Navigation","Layered navigation for custom collection on a custom page in Magento 2","layered navigation for custom page","layered navigation issue in custom collection","product count is wrong in custom collection","toolbar issue in custom collection"],"articleSection":["Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/","name":"magento 2 Layered navigation","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_-937x1024.png","datePublished":"2022-02-18T19:37:20+00:00","dateModified":"2024-07-26T07:08:18+00:00","description":"Layered navigation for custom collection on a custom page in Magento 2, how we can create based on Magento 2 layered navigation for our custom collection on a custom page.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/02\/192.168.15.170_mage243_pub_mycollection_index_index_.png","width":1920,"height":2098,"caption":"192.168.15.170_mage243_pub_mycollection_index_index_"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/layered-navigation-for-custom-collection-on-a-custom-page-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Layered navigation for custom collection on a custom page in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca","name":"Khushboo Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Khushboo Sahu"},"url":"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/322845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/249"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=322845"}],"version-history":[{"count":11,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/322845\/revisions"}],"predecessor-version":[{"id":454870,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/322845\/revisions\/454870"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=322845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=322845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=322845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}