Add Module In /templates/shaper_hope/html/com_content/article/default.php - Question | JoomShaper
🎃 Halloween Sale is Live! Get 35% OFF on all plans. Sale ends soon! Get Offer

Add Module In /templates/shaper_hope/html/com_content/article/default.php

T

TKIF2016IT

General 8 months 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

0
4 Answers
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 8 months ago #184465

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.

0
T
TKIF2016IT
Accepted Answer
8 months ago #184469

Really ,thank so much

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 8 months ago #184474

Please marked the issue as solved

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 8 months ago #184479

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.

0