WordPress.org

Forums

Content Warning
How-To: Change width and height (6 posts)

  1. Jerry
    Member
    Plugin Author

    Posted 3 years ago #

    First off I would like to say that I will be adding this in an update as an option for the users, but for now this is a simple hack at the code you can use.

    To start off, you should note that CWv2 utilizes the "Thickbox" API that's built into WordPress. Therefore to show the window it uses AJAX calls within the function. For this how-to I'll be using the /content-warning-v2/assets/wpcwv2.dev.js file as it's not compressed. However for this alteration to work you need to use its contents to overwrite the wpcwv2.js file.

    I honestly was going to separate it into parts, but it's too simplified to do so, just open the dev.js file for the front-end and find the two functions show_tp() and show_denied_tb()

    Change the height and width parameters for the ajax call, just take care not to change the other parameters.

    Example (regular code):

    function show_tb() {
        tb_show('Warning', cwv2Params.url + '?m=buildMessage&p=' + cwv2Params.postID + '&height=300&width=500&modal=true', false)
    }

    Changing the height and width by adding 200:

    function show_tb() {
        tb_show('Warning', cwv2Params.url + '?m=buildMessage&p=' + cwv2Params.postID + '&height=500&width=700&modal=true', false)
    }

    Once you change the values remember to go into the wpcw.css file and change the #wpdoor_msg to a height of 100 less than what you changed it to within the javascript file. For instance our css would now read:
    #wpdoor_msg{height: 400px;}

    Hope that helps some of ya until I can get a chance to update the plugin, happy coding.

    http://wordpress.org/extend/plugins/content-warning-v2/

  2. testuserfay
    Member
    Posted 3 years ago #

    Hi, I tried this and it did not work. Specifically, this:

    Once you change the values remember to go into the wpcw.css file and change the #wpdoor_msg to a height of 100 less than what you changed it to within the javascript file. For instance our css would now read:
    #wpdoor_msg{height: 400px;}

    made the box act strangely. It did not enlarge the box for me.

    More help would be appreciated. Thank you

  3. wylesight
    Member
    Posted 2 years ago #

    Hi, it's not working by just changing values in wpcwv2.dev.js, you need to update wpcwv2.js.

    However I'm wondering how to give percentage values to the modal box so it can resize depending on screen resolution (mobile devices more specifically) ?

    Thank u for ur help !!

  4. stillrivercreative
    Member
    Posted 2 years ago #

    Hi, these instructions worked well. Thanks

  5. Jerry
    Member
    Plugin Author

    Posted 2 years ago #

    @wylesight
    The modal box uses WordPress' default Thickbox Plugin, so the parameters are based on that. I may look into using a different modal plugin though.

  6. kikibelux
    Member
    Posted 2 years ago #

    nice pluging, is it possible that block cover 90% of screen ?
    To hide the background ?

    Thanks a lot

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Content Warning
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic