Jump to content

Create a ClientAreaPrimarySidebar Hook for the Home Page Only


HostCuritiba

Recommended Posts

Create a ClientAreaPrimarySidebar Hook for the Home Page Only
Hello? I'm new to WHMC production and tried to create my first hook. The problem is that it works fine, but on all internal pages. I need the hook only for the home page. Is it possible to avoid repeating this on all internal pages?

If anyone can help me, I'd be grateful.

~~~~

<?php
use WHMCS\View\Menu\Item as MenuItem;
 // Add social media links to the end of all secondary sidebars.
add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $secondarySidebar)
{
    // Add a panel to the end of the secondary sidebar for social media links.
    // Declare it with the name "slider" so we can easily retrieve it
    // later.
    $secondarySidebar->addChild('slider', array(
        'label' => 'Atendimento',
        'uri' => '#',
        'icon' => 'fa fa-sun-o',
    ));
 
     // Retrieve the panel we just created.
    $sliderPanel = $secondarySidebar->getChild('slider');
 
    // Move the panel to the end of the sorting order so it's always displayed
    // as the last panel in the sidebar.
    $sliderPanel->moveToFront();
        
    // Add a Facebook link to the panel.
    $sliderPanel->addChild('facebook-link', array(
        'label' => '<div class="sidebar-atendimento">
        <div class="status-message" id="statusMessage">
            <div class="status-header">
                <span class="status-title" id="statusTitle">Carregando status...</span>
                <div class="status-icon-small" id="statusIcon"></div>
            </div>
            <div class="status-description" id="statusDescription"></div>
        </div>
        
        <div class="horario-info">
            <div class="horario-title">Horário de Atendimento:</div>
            <div><strong>Abertos:</strong> 08:00 às 18:00, Seg-Sexta</div>
            <div><strong>Fechados:</strong> Domingos e Feriados</div>
        </div>
        
        <div class="nota-fiscal">
            <strong>Nota Fiscal:</strong> Pedidos de Notas Fiscais, solicitações são somente via ticket.
        </div>
        
        <div class="buttons-container">
            <a href="https://wa.me/5541995558123?text=Tenho dúvidas, Gostaria de mais informações... " target="_blank" class="botoes-sidebar">
                WhatsApp
            </a>
            <a href="javascript:void(Tawk_API.toggle())" class="botoes-sidebar">
                WebChat
            </a>
        </div>

        <div class="niveis-suporte">
            <div class="niveis-title">Níveis de Suporte:</div>
            <div class="nivel-item"><strong>Premium:</strong> Planos Premium garante um atendimento por ticket e WhatsApp</div>
            <div class="nivel-item"><strong>Padrão:</strong>  Planos Padrões todos os pedidos devem ser somente via tickets.</div>
            <div class="nivel-item"><strong>Dúvidas:</strong> Para dúvida ou contratações, o chat pode ser acionado para todos.</div>
        </div>
    </div>',

    ));
});
~~~~

I have some catches.
The hook should only be displayed in the client area on the home screen.

widjet-sidebar-hook-whmcs.jpg

widjet-sidebar-hook-whmcs-2.jpg

Link to comment
Share on other sites

Thank you for your reply, please let me know if I would add this line below or what the complete code would look like? I apologize, I really don't know how to program at all.

<?php
use WHMCS\View\Menu\Item as MenuItem;
 // Add social media links to the end of all secondary sidebars.
add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $secondarySidebar)
{
if ($scriptName !== 'index.php') { return; }   <<=====Would this be to add the page on any line?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated