Home Forums Xi Theme Discussion & Support Custom Widget with "content-box"

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  themeweaver 4 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3372

    Cam Collins
    Participant
    Post count: 8

    Loominaries –

    I am trying to tailor the widget used in the Events Manager plugin so that it has a similar styling to the ThemeLoom – Show Events widget. I thought that wrapping the code that “echoes” events with id=”los-events” and class=”content-box” would do the trick.

    // Wrap in content-box from Living_OS Xi theme
            echo '<div id="los-event" class="content-box" >';
                    echo '<u class="los_events"l>';
                            // echo events with <li></li> tags
                    echo "</ul>";
            echo '</div>';
            echo $args['after_widget'];
    

    But alas, no dice. No errors when I “Inspect Element” in Chrome Developer.

    Thanks!

    #3377

    themeweaver
    Keymaster
    Post count: 730

    Is this really your code? Your ul element won’t work as you have a bit of a typo.

    #3382

    Cam Collins
    Participant
    Post count: 8

    No thats not what I have. Must have transposed incorrectly in the forum. This is what I have:

    // Wrap in content-box from Living_OS Xi theme
            echo '<div id="los-event" class="content-box" >';
                    echo '<ul>';
                            // echo events with <li></li> tags
                    echo '</ul>';
            echo '</div>';
            echo $args['after_widget'];
    
    #3383

    Cam Collins
    Participant
    Post count: 8

    I got this to work and wanted to pass along a solution in case anyone else tries it. I had to create a CSS file that includes the content-box styling. I then “enqueued” the CSS file in the function that lists the events:

    wp_enqueue_style('content-box' , get_template_directory_uri() . '../ChildTheme/content-box.css'); //css for the content box

    This issue is resolved…

    #3384

    Cam Collins
    Participant
    Post count: 8

    I wanted to improve this answer some. I found it preferable to keep the new CSS file in my child theme directory. I could have also added this CSS code to my child theme style.css file. But nonetheless, to get the child theme URI and not the parent theme URI you need to use ‘get_stylesheet_directory_uri’

    wp_enqueue_style('content-box', get_stylesheet_directory_uri() . '/content-box.css'); //css for the content box
    #3385

    themeweaver
    Keymaster
    Post count: 730

    That is a good way to go about things. It keeps your plugin styles separate and uses a child theme, which is always the best approach to theme customisation.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.