development

  1. Magento 2 Blog GraphQL Queries Examples

    The examples of some GraphQL queries for the Magento 2 blog module are presented in this article. With these queries, you will be able to extract the necessary blog data for Progressive Web Application (PWA). The queries are easily tested in the ChromeiQL - Chrome Browser Extension.

    Note that Magento 2 Blog GraphQL addition should be installed first.

    To check the full Blog GraphQL schema please see the 

    Read more »
  2. Resize Blog Post Images Programmatically

    To get resized post image you can use next code in your template files:

     <?php
       $width = 100;
       $height = 150;
       $imageHelper = $this->helper(\Magefan\Blog\Helper\Image::class);
     ?>
    <img
       src="<?php echo $imageHelper->init($_post->getFeaturedImg())->resize($width, $height); ?>"
       alt="<?php echo $block->escapeHtml($_post->getTitle(), null, true) ?>" />
    
    Read more »
  3. Change The Layout For All Magento 2 Blog Pages

    If you use Magefan Blog Extension for Magento 2 and need to change the layout e.g. from "2 columns with a right sidebar" to "2 columns with a left sidebar" for all blog pages, please do next:

    1. Create a file

    app/design/ThemeVendor/themename/Magefan_Blog/layout/blog_default.xml

    2. Add the code into it

    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    </page>

    Read more »
  4. Add Custom Field To Magento 2 Blog Post

    If you need to extend Magento 2 Blog Module by Magefan and add a new custom text field to Blog Post edit page in Magento 2 Admin panel (Content  > Blog > Posts) you must to create a simple custom Magento 2 Extension.

    You can download a sample extension from our GitHub page or you can create it manually using the steps below:

    1. Create composer.json file

    app/code/Magefan/BlogCustomField/composer.json
    {
    "name": "magefan/module-blog-custom-field",
    "description": "Implements Blog functionality on Magento 2 store",
    "require": {
    "magefan/module-blog" : ">=2.8.0"
    },
    "type": "magento2-module",
    "version": "2.0.0",
    "license": [
    "OSL-3.0",
    "AFL-3.0"
    ],
    "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
    "Magefan\\BlogCustomField\\": ""
    }
    }
    }

     

    Read more »
  5. Display Tag Count In The Magento 2 Blog Tag Cloud Sidebar

    If you need to display tag count in the Magento 2 Blog tag cloud sidebar, you need to extend the tags sidebar template.

    To do this:

    1. Copy the template file from the Blog extension folder

    view/frontend/templates/sidebar/tag_claud.phtml

    to your theme folder

    app/design/frontend/ThemeVendor/themename/Magefan_Blog/templates/sidebar/tag_claud.phtml

    Read more »
  6. Remove Blog Top Link In SmartWave Porto Theme

    SmartWave Porto Theme for Magneto 2 includes Magefan Blog Extension out of the box and adds the blog link to the header top links.

    If you want to remove the blog from the top links, please follow these steps:

    1. Create a new file in your child theme (ThemeVendor/theme-name) directory:

    app/design/frontend/ThemeVendor/theme-name/Magefan_Blog/layout/default.xml 
    Read more »
  7. Magento2 Ultimo Theme Blog Link in Menu

    If you have already installed Magento 2 Blog Module v2.6.2 (or later) you can easily add a blog link to the Menu on your Ultimo theme.

    Read more »
  8. The Blog Links in SmartWave Porto Mega Menu

    If you have already installed Magento 2 Blog Module v2.6.2 (or later) you can easily add a blog and blog categories links to the SmartWave Mega Menu.

    Read more »
^Top
Chat