WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend
wpuf breaks the theme's layout (8 posts)

  1. mpeimpiii
    Member
    Posted 1 year ago #

    I just updated wpuf to v1.0 and in the main loop page it messes with the layout. The wpuf.css is loaded (linked) in every page in the site and it includes a clear css class

    .clear{
        clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    }

    clear is also used by my theme and since wpuf.css is loaded after the theme's css whenever .clear is used my font-size and line-height have the values of wpuf .clear (1px and 0px).

    http://wordpress.org/extend/plugins/wp-user-frontend/

  2. Daedalon
    Member
    Posted 1 year ago #

    Any plugin-specific CSS should use classes and IDs with prefixes to avoid these problems. In this case tha class should be for example "wpuf_clear" instead of "clear". I also have a theme that ships with an already-defined "clear" class.

    Mpeimpiii, not knowing your PHP skills, you might be able to fix this problem with your layout by manually tweaking the plugin while waiting for a plugin update to fix it for good. Edit the CSS file to change the class names, and then find where the same classes are referred to in the .php files and change them the same way. Hopefully Tareq fixes this in the next version - I don't see the changelog mentioning this fixed in today's 1.1.

  3. mpeimpiii
    Member
    Posted 1 year ago #

    Unfortunately v1.1 doesn't resolve the .clear problem. Since it's being
    referenced in many places i've decided to add an extra check in the wpuf.php file (where the include of wpuf.css is done) for wpuf's shortcodes and now only if a wpuf shortcode is included the css is loaded.

  4. Daedalon
    Member
    Posted 1 year ago #

    That sounds like a good patch to improve the plugin performance. Serving the .css when it's not needed is a waste of good bandwidth. If you could give a copy-paste of the changes you've made, hopefully Tareq will incorporate that patch in addition to the fix suggested above.

  5. mpeimpiii
    Member
    Posted 1 year ago #

    At function enqueue_scripts() of wpuf.php right after the line
    require_once ABSPATH . '/wp-admin/includes/template.php';

    i replaced the line
    wp_enqueue_style( 'wpuf', $path . '/css/wpuf.css' );

    with

    if ( has_shortcode( 'wpuf_addpost' ) || has_shortcode( 'wpuf_edit' ) ||               has_shortcode( 'wpuf_dashboard' ) || has_shortcode( 'wpuf_editprofile' ) ) {
            wp_enqueue_style( 'wpuf', $path . '/css/wpuf.css' );
    }

    I strongly agree with you that the plugin css should have a prefix to uniquely identify itself, so i'm hope Tareq will rename .clear class in .wpuf-clear, like he's done in others css classes inside wpuf.css.

  6. Daedalon
    Member
    Posted 1 year ago #

    Excellent, thanks!

    Tareq: When you have time to read this, could you incorporate the two fixes mentioned in the mpeimpiii's post just above this one?

  7. Aulait
    Member
    Posted 1 year ago #

    Took me all day to search for a solution, included your fix and it works!

    Awesome! Thanks for saving me more hours!!

  8. Dinesh Kesarwani
    Member
    Posted 1 year ago #

    Hi tareq1998,

    If you include the above provided method by mpeimpiii it will help to plugin users and developers without affecting their original codes.

    if ( has_shortcode( 'wpuf_addpost' ) || has_shortcode( 'wpuf_edit' ) ||               has_shortcode( 'wpuf_dashboard' ) || has_shortcode( 'wpuf_editprofile' ) ) {
            wp_enqueue_style( 'wpuf', $path . '/css/wpuf.css' );
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.