Important. We are closed. Due to decreased amount of time available, we don't accept new orders and we don't provide support for existing ones.

- MANADEV is the best, excellent support (5-Star)

Aug 22, 2012 Absolutex

Certified Magento Enterprise developer Certified Magento developer Certified Magento theme developer Certified Magento specialist

Manadev is certified extension and theme
developer for Magento

How It Works

Contents:

Customizing Content

When visual page description is being rendered, often it already contains some HTML markup. For example, on category pages, page description HTML markup is rendered from category description.

With Filter Specific Content for Magento 2 extension installed, instead of rendering this default description, page description is rendered using Manadev_FilterSpecificContent::description.phtml template file. By default, this template file just renders default page description:

<?php echo $this->originalDescription() ?>

However, it is a perfect place to introduce filter specific content to page description with the following kind of logic:

<?php if ($this->filter('activity')->contains('Gym')): ?>
    <p>This gym-specific description is rendered instead of default one</p>

<?php elseif ($this->filter('activity')->contains('Hiking')): ?>
    <?php echo $this->originalDescription() ?>
    <p>This hiking-specific description is rendered after default one</p>

<?php elseif ($this->filter('activity')->contains('Overnight')): ?>
    <p>This overnight-specific description is rendered before default one</p>
    <?php echo $this->originalDescription() ?>

<?php elseif ($this->filter('activity')->contains('School')): ?>
    <p>This school-specific description is rendered before default one</p>
    <?php echo $this->originalDescription() ?>
    <p>This school-specific description is rendered after default one</p>

<?php else: // if none of the above conditions is met, default page description is rendered ?>
    <?php echo $this->originalDescription() ?>

<?php endif; ?>

What Can Be Customized

Filter Specific Content for Magento 2 extension allows you to customize not only visual page description, but also:

  • Meta title
  • Meta description
  • Meta keywords
  • Meta robots
  • Page title (<h1>)
  • Page subtitle (<h2>)

Standard vs Alternative Syntax

In visual content templates - page title (<h1>), page subtitle (<h2>), page description - as in example above, we recommend using PHP syntax which can be commonly found in other PHTML files which is known as alternative syntax for control structures, as with this syntax HTML markup is more readable.

In non-visual content templates - meta title, meta description, meta keywords, meta robots - we recommend using plain PHP control structures as it allows better control over white space. Below is the same example for meta description:

if ($this->filter('activity')->contains('Gym')) {
    echo "This gym-specific description is rendered instead of default one";

} elseif ($this->filter('activity')->contains('Hiking')) {
    echo "{$this->originalMetaDescription()} This hiking-specific description is rendered after default one";

} elseif ($this->filter('activity')->contains('Overnight')) {
    echo "This overnight-specific description is rendered before default one. {$this->originalMetaDescription()}";

} elseif ($this->filter('activity')->contains('School')) {
    echo "This school-specific description is rendered before default one {$this->originalMetaDescription()} " .
         "This school-specific description is rendered after default one";

} else { // if none of the above conditions is met, default meta description is rendered
    echo $this->originalMetaDescription();
}

We Accept: PayPal Visa MasterCard American Express Discover