WordPress.org

Ready to get started?Download WordPress

Forums

How to enqueue the style using wp_enqueue_style() (1 post)

  1. Mayeenul Islam
    Member
    Posted 1 year ago #

    I'm developing a theme. I added the codes (below) into the header.php. But I posted it into the theme repository, and it's under review, and the reviewer informed me to enqueue the style with wp_enqueue_style()/wp_enqueue_script(). But can't understand how to implement it with the function. I've seen the directed wp_enqueue_style();, but can't understand how to put the whole bunch of codes with their conditions.

    <style type="text/css">
    <?php
    // If the menu presents, then CSS loads
    
    if ( has_nav_menu( 'secondary' ) ) {
    ?>
    .sec-menu{
    width: 100%;
    background: #333;
    height: 26px;
    font-size:16px;
    text-transform:uppercase;
    }
    <?php } ?>
    <?php
    if ( has_nav_menu( 'primary' ) ) {
    ?>
    #access{
    background-color: #333;
    height: 26px;
    }
    <?php } ?>
    <?php
    if ( !has_nav_menu( 'primary' ) && !has_nav_menu( 'secondary' ) ) {
    ?>
    .sec-menu,
    #access{
    border-bottom: 2px solid #333;
    }
    <?php } ?>
    </style>

    Anybody can help me here?

Topic Closed

This topic has been closed to new replies.

About this Topic