add module in /templates/shaper_hope/html/com_content/article/default.php - Forum | JoomShaper
Staff replied General

add module in /templates/shaper_hope/html/com_content/article/default.php

Asked by TKIF2016IT 1 year ago Last activity 1 year ago

hi
I need just small help i have module the name yyy and its in the postion7

i need the line code to add this module in com_content/article/default.php file

what should i write to add the module yyy which in postion7 to appear in com_content/article/default.php file

what like code should i write

4 replies

Atick Eashrak Shuvo Staff

Apolozy for the inconvenience. Customization is out of our support scope. However, I'm providing you with a small code snippet as a good starting point. Please note that we only provide technical support.

Add the below code in your JRoot/templates/shaper_hope/html/com_content/article/default.php file

<?php

            use Joomla\CMS\Helper\ModuleHelper;

            $modules = ModuleHelper::getModules('position7');
            if (!empty($modules)) {
                foreach ($modules as $module) {
                    echo '<div class="custom-module">';
                    if ($module->showtitle) { // Show title only if enabled in settings
                        echo '<h3>' . htmlspecialchars($module->title) . '</h3>';
                    }
                    echo ModuleHelper::renderModule($module);
                    echo '</div>';
                }
            }
            ?>

Important: This modification is not update-proof. Any Joomla update or template update may overwrite the default.php file, removing your changes.

TKIF2016IT Asked this

Really ,thank so much

Atick Eashrak Shuvo Staff
1 year ago · edited

Please marked the issue as solved

Paul Frankowski Senior Staff

BTW

Notice! Editing template files is not always the best way. Also becuase during template update all your php changes will be overriden by template files. So keep that changed file in backup folder.

Log in to reply.