Skip to content

Detecting within a template if the "home page"? #116

Description

@sweetappleuk

In prior versions of the module you could detect if the template rendering was the Homepage within a template with

if( $this->getRequest()->getFullActionName() == 'wordpress_homepage_view')

This seems to have stopped working with one of the more recent refactors, as this now returns 'wordpress_postType_view' which on the face of it seems much more ambiguous. How would you suggest rendering different content on the home page/ without doing something awful like hardcoding the bog home url path?

Modifying wordpress_homepage_view.xml and adding something like this to render an alternate template?

<referenceBlock name="wp.post.list">
    <action method="setTemplate">
        <argument name="template" xsi:type="string">FishPig_WordPress::list/wrapper-home.phtml</argument>
    </action>
</referenceBlock>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions