Как да му добавя бутон за скриване ?

Дискусията в 'Webmaster Help - Секцията на Експертите' стартирана от Scanolions, Ян 11, 2019 в 12:05 PM.

  1. Scanolions

    Scanolions Member

    Рег.:
    Септ 26, 2011
    Съобщения:
    155
    Харесвания:
    16
    Точки:
    18
    Инсталирах си един плъгин floating ads bottom за появята на реклама долу. Всичко е както исках, обаче човека, който е направил плъгина нарочно или забравил не е сложил бутон за скриване на тази реклама. Смисъл рекламата постоянно си седи и не може да се затвори. Като отворих папката на плъгина забелязах, че има само един php файл и явно този трябва да се редактира малко за да се появи такъв бутон. Някой ако може да ми помогне с това ето целия код от файла. Къде трябва да се пипа и какво трябва да се редактира си нямам и на идея.

    PHP:
    <?php

    /**

     *

     * Plugin Name:       Floating Ads Bottom

     * Plugin URI:           http://wp.labnul.com/plugin/floating-ads-bottom/

     * Description:       Increase your adsense click using Floating Ads at the Bottom wordpress plugin. Inject floating ad at the bottom of your visitor screen. Start <a href="options-general.php?page=floating-ads-bottom">Floating Ads Bottom</a>.

     * Version:           1.0.0

     * Author:            Aby Rafa

     * Author URI:        http://wp.labnul.com/

     * Text Domain:       floating-ads-bottom

     * Domain Path          /languages

     * License:           GPL-2.0+

     * License URI:       https://www.gnu.org/licenses/gpl-2.0.txt

     *

     

    Floating Ads Bottom is free software: you can redistribute it and/or modify

    it under the terms of the GNU General Public License as published by

    the Free Software Foundation, either version 2 of the License, or

    any later version.



    Floating Ads Bottom is distributed in the hope that it will be useful,

    but WITHOUT ANY WARRANTY; without even the implied warranty of

    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

    GNU General Public License for more details.



    You should have received a copy of the GNU General Public License

    along with Floating Ads Bottom. If not, see https://www.gnu.org/licenses/gpl-2.0.html.

    */



    function floating_ads_bottom_css() { ?>

    <style type='text/css'>#floating_ads_bottom_textcss { width: 100%; margin: auto; text-align: center; float: none; overflow: hidden; display: scroll; position: fixed; bottom: 0; z-index: 9999 } #floating_ads_bottom_textcss2 { display: block; max-width: 728px; height: auto; overflow: hidden; margin: auto; }</style><?php

    }

    function 
    floating_ads_bottom_div() { ?>

    <div id="floating_ads_bottom_textcss">

        <center><div id="floating_ads_bottom_textcss2">   

            <?php echo get_option('floating_ads_bottom_script'); ?>   

        </div><center>

    </div><?php

    }



    if (
    is_admin()) add_action('admin_menu''floating_ads_bottom_menu');

    else {

        if (
    get_option('floating_ads_bottom_status') == "1") {

            if (
    get_option('floating_ads_bottom_desktop') == "1") {

                if (!
    wp_is_mobile()) {

                    
    add_action('wp_head','floating_ads_bottom_css');

                    
    add_action('wp_footer','floating_ads_bottom_div');

                }

            }

            if (
    get_option('floating_ads_bottom_mobile') == "1") {

                if (
    wp_is_mobile()) {

                    
    add_action('wp_head','floating_ads_bottom_css');

                    
    add_action('wp_footer','floating_ads_bottom_div');

                }

            }

        }

    }



    function 
    floating_ads_bottom_menu() {

        
    add_options_page("Floating Ads Bottom Page","Floating Ads Bottom","manage_options","floating-ads-bottom","floating_ads_bottom_wrap");

        
    add_action'admin_init''floating_ads_bottom_reg' );

    }



    function 
    floating_ads_bottom_reg() {

        
    register_setting'floating-ads-bottom-abyrafa''floating_ads_bottom_script' );

        
    register_setting'floating-ads-bottom-abyrafa''floating_ads_bottom_status' );

        
    register_setting'floating-ads-bottom-abyrafa''floating_ads_bottom_mobile' );

        
    register_setting'floating-ads-bottom-abyrafa''floating_ads_bottom_desktop' );

    }



    function 
    floating_ads_bottom_wrap() { ?>

    <div class="wrap">

        <h1>Floating Ads Bottom</h1>

        <form method="post" action="options.php">

        <?php

            settings_fields
    'floating-ads-bottom-abyrafa' );

            
    do_settings_sections'floating-ads-bottom-abyrafa' );

        
    ?>

            <div id="dashboard-widgets-wrap">

                <div id="dashboard-widgets" class="metabox-holder">

                    <div id="postbox-container-2" class="postbox-container">

                        <div id="side-sortables" class="meta-box-sortables">

                            <div id="dashboard_primary" class="postbox ">

                                <h2 class="hndle"><span>About Plugin:</span></h2>

                                <div class="inside">

                                    <div class="rss-widget">

                                        <div style="float:left; margin-right:25px;">

                                            <p><img src="<?php echo plugins_url("images/home.jpg"__FILE__); ?>" /> <a href="http://wp.labnul.com/plugin/floating-ads-bottom/" target="_blank">Plugin Homepage</a></p>

                                        </div>

                                        <div style="clear:left;"></div>

                                    </div>

                                </div>

                            </div>

                        </div>

                    </div>

                    <div id="postbox-container-1" class="postbox-container">

                        <div id="side-sortables" class="meta-box-sortables">

                            <div id="dashboard_primary" class="postbox ">

                                <h2 class="hndle"><span>Adsense Visibility</span></h2>

                                <div class="inside">

                                    <div class="rss-widget"><br />

                                        <input name="floating_ads_bottom_desktop" type="checkbox" value="1" <?php checked(1get_option('floating_ads_bottom_desktop'),true); ?>/> Desktop Browser

                                        <br /><br />

                                        <input name="floating_ads_bottom_mobile" type="checkbox" value="1" <?php checked(1get_option('floating_ads_bottom_mobile'),true); if(false===get_option('floating_ads_bottom_mobile')) echo "checked"?> /> Mobile Browser<br /><br />

                                    </div>

                                </div>

                                <h2 class="hndle"><span>Responsive ad units script</span></h2>

                                <div class="inside">

                                    <div class="rss-widget"><br />                                           

                                        <textarea id="floating_ads_bottom_script" name="floating_ads_bottom_script" class="large-text code" rows="9"><?php echo esc_textarea(get_option('floating_ads_bottom_script')); ?></textarea>

                                        <input type="radio" name="floating_ads_bottom_status" value="1" <?php checked(1get_option('floating_ads_bottom_status'),true); ?>>Enable</input>&nbsp;&nbsp;&nbsp;

                                        <input type="radio" name="floating_ads_bottom_status" value="0" <?php checked(0get_option('floating_ads_bottom_status'),true); if(false===get_option('floating_ads_bottom_status')) echo "checked"?>>Disable</input><br /><br />

                                        <?php submit_button(); ?>

                                    </div>

                                </div>                           

                            </div>

                        </div>                           

                    </div>                       

                </div>

            </div>           

        </form>

    </div>

    <?php ?>
     
  2. deepdoff

    deepdoff Member

    Рег.:
    Май 14, 2018
    Съобщения:
    109
    Харесвания:
    16
    Точки:
    18
    Пол:
    Мъж
    Виж просто как е обозначен или id на div който искаш да скриеш, и през custom css редактирай style.css файла добави най долу ако div е <div class="ads_div_text">
    .ads_div_text {
    display:none;
    }
    или ако е id="ads_div_text"
    #ads_div_text {
    display:none;
    }

    И ще го скриеш.
    Или ми прати на лично сайта кажи ми кое искаш да скриеш и ще ти помогна.
     
  3. Scanolions

    Scanolions Member

    Рег.:
    Септ 26, 2011
    Съобщения:
    155
    Харесвания:
    16
    Точки:
    18
    Имаш ЛС
     
  4. cross

    cross Well-Known Member

    Рег.:
    Юни 2, 2015
    Съобщения:
    2,147
    Харесвания:
    245
    Точки:
    63
    Пол:
    Мъж
    Професия:
    Копирайтър, WordPress специалист
    Място:
    София
    Това ще скрие въпросния елемент, човекът май иска да добави бутон за скриването му от потребителя.
     
  5. Scanolions

    Scanolions Member

    Рег.:
    Септ 26, 2011
    Съобщения:
    155
    Харесвания:
    16
    Точки:
    18
    Да искам да сложа бутон за потребителя, който не иска да види рекламата да натисне X и да се затвори.
     
  6. ReminD

    ReminD Well-Known Member

    Рег.:
    Ян 22, 2008
    Съобщения:
    6,244
    Харесвания:
    1,165
    Точки:
    113
  7. Scanolions

    Scanolions Member

    Рег.:
    Септ 26, 2011
    Съобщения:
    155
    Харесвания:
    16
    Точки:
    18
    Направих така

    <a href="#" id="close">Close my dumb ad</a>
    <script>
    $("#close").click(function(){
    $("#floating_ads_bottom_textcss2").hide();
    })
    </script>

    Надписа за Close излиза, но нещо не ще да скрие този div
     
  8. ReminD

    ReminD Well-Known Member

    Рег.:
    Ян 22, 2008
    Съобщения:
    6,244
    Харесвания:
    1,165
    Точки:
    113
    Дай кода с дива
     
  9. Scanolions

    Scanolions Member

    Рег.:
    Септ 26, 2011
    Съобщения:
    155
    Харесвания:
    16
    Точки:
    18
    Код:
    <?php
    /**
     *
     * Plugin Name:       Floating Ads Bottom
     * Plugin URI:           http://wp.labnul.com/plugin/floating-ads-bottom/
     * Description:       Increase your adsense click using Floating Ads at the Bottom wordpress plugin. Inject floating ad at the bottom of your visitor screen. Start <a href="options-general.php?page=floating-ads-bottom">Floating Ads Bottom</a>.
     * Version:           1.0.0
     * Author:            Aby Rafa
     * Author URI:        http://wp.labnul.com/
     * Text Domain:       floating-ads-bottom
     * Domain Path          /languages
     * License:           GPL-2.0+
     * License URI:       https://www.gnu.org/licenses/gpl-2.0.txt
     *
     
    Floating Ads Bottom is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    any later version.
    
    Floating Ads Bottom is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with Floating Ads Bottom. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
    */
    function floating_ads_bottom_css() { ?>
    <style type='text/css'>#floating_ads_bottom_textcss { width: 100%; margin: auto; text-align: center; float: none; overflow: hidden; display: scroll; position: fixed; bottom: 0; z-index: 9999 } #floating_ads_bottom_textcss2 { display: block; max-width: 728px; height: auto; overflow: hidden; margin: auto; }</style><?php
    }
    function floating_ads_bottom_div() { ?>
    <div id="floating_ads_bottom_textcss">
    <a href="#" id="close">Close my dumb ad</a>
    <script>
    $("#close").click(function(){
    $("#floating_ads_bottom_textcss2").hide();
    })
    </script>
        <center><div id="floating_ads_bottom_textcss2">   
            <?php echo get_option('floating_ads_bottom_script'); ?>   
        </div><center>
    </div><?php
    }
    
    if (is_admin()) add_action('admin_menu', 'floating_ads_bottom_menu');
    else {
        if (get_option('floating_ads_bottom_status') == "1") {
            if (get_option('floating_ads_bottom_desktop') == "1") {
                if (!wp_is_mobile()) {
                    add_action('wp_head','floating_ads_bottom_css');
                    add_action('wp_footer','floating_ads_bottom_div');
                }
            }
            if (get_option('floating_ads_bottom_mobile') == "1") {
                if (wp_is_mobile()) {
                    add_action('wp_head','floating_ads_bottom_css');
                    add_action('wp_footer','floating_ads_bottom_div');
                }
            }
        }
    }
    
    function floating_ads_bottom_menu() {
        add_options_page("Floating Ads Bottom Page","Floating Ads Bottom","manage_options","floating-ads-bottom","floating_ads_bottom_wrap");
        add_action( 'admin_init', 'floating_ads_bottom_reg' );
    }
    
    function floating_ads_bottom_reg() {
        register_setting( 'floating-ads-bottom-abyrafa', 'floating_ads_bottom_script' );
        register_setting( 'floating-ads-bottom-abyrafa', 'floating_ads_bottom_status' );
        register_setting( 'floating-ads-bottom-abyrafa', 'floating_ads_bottom_mobile' );
        register_setting( 'floating-ads-bottom-abyrafa', 'floating_ads_bottom_desktop' );
    }
    
    function floating_ads_bottom_wrap() { ?>
    <div class="wrap">
        <h1>Floating Ads Bottom</h1>
        <form method="post" action="options.php">
        <?php
            settings_fields( 'floating-ads-bottom-abyrafa' );
            do_settings_sections( 'floating-ads-bottom-abyrafa' );
        ?>
            <div id="dashboard-widgets-wrap">
                <div id="dashboard-widgets" class="metabox-holder">
                    <div id="postbox-container-2" class="postbox-container">
                        <div id="side-sortables" class="meta-box-sortables">
                            <div id="dashboard_primary" class="postbox ">
                                <h2 class="hndle"><span>About Plugin:</span></h2>
                                <div class="inside">
                                    <div class="rss-widget">
                                        <div style="float:left; margin-right:25px;">
                                            <p><img src="<?php echo plugins_url("images/home.jpg", __FILE__); ?>" /> <a href="http://wp.labnul.com/plugin/floating-ads-bottom/" target="_blank">Plugin Homepage</a></p>
                                        </div>
                                        <div style="clear:left;"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="postbox-container-1" class="postbox-container">
                        <div id="side-sortables" class="meta-box-sortables">
                            <div id="dashboard_primary" class="postbox ">
                                <h2 class="hndle"><span>Adsense Visibility</span></h2>
                                <div class="inside">
                                    <div class="rss-widget"><br />
                                        <input name="floating_ads_bottom_desktop" type="checkbox" value="1" <?php checked(1, get_option('floating_ads_bottom_desktop'),true); ?>/> Desktop Browser
                                        <br /><br />
                                        <input name="floating_ads_bottom_mobile" type="checkbox" value="1" <?php checked(1, get_option('floating_ads_bottom_mobile'),true); if(false===get_option('floating_ads_bottom_mobile')) echo "checked"; ?> /> Mobile Browser<br /><br />
                                    </div>
                                </div>
                                <h2 class="hndle"><span>Responsive ad units script</span></h2>
                                <div class="inside">
                                    <div class="rss-widget"><br />                                           
                                        <textarea id="floating_ads_bottom_script" name="floating_ads_bottom_script" class="large-text code" rows="9"><?php echo esc_textarea(get_option('floating_ads_bottom_script')); ?></textarea>
                                        <input type="radio" name="floating_ads_bottom_status" value="1" <?php checked(1, get_option('floating_ads_bottom_status'),true); ?>>Enable</input>&nbsp;&nbsp;&nbsp;
                                        <input type="radio" name="floating_ads_bottom_status" value="0" <?php checked(0, get_option('floating_ads_bottom_status'),true); if(false===get_option('floating_ads_bottom_status')) echo "checked"; ?>>Disable</input><br /><br />
                                        <?php submit_button(); ?>
                                    </div>
                                </div>                           
                            </div>
                        </div>                           
                    </div>                       
                </div>
            </div>           
        </form>
    </div>
    <?php } ?>
     
  10. ReminD

    ReminD Well-Known Member

    Рег.:
    Ян 22, 2008
    Съобщения:
    6,244
    Харесвания:
    1,165
    Точки:
    113
    Аха, ама направи го като хората, бутни jquery-то във фуутера както си му е реда и го сложи в $( document ).ready() , и то се подразбира, че би трябвало да има jquery, но виж все пак ако в конзолата пищи нещо от рода на "$ is not defined".
    И като гледам мазаляка на WP + html се вижда, че отгоре се отваря функцията, която ще бутне рекламите, тоест имаш { за отваряне, и след това се затваря php тага и там си бутнал кода, тоест in the end тоя код ще си стои във функцията... Разкарай кода, който си добавил и го добави просто във footer-а, както си му е реда.


    пс: тея от wordpress защо още не са минали на читав template engine, а всичко е толкова грозно и едва четимо с 1000 затварящи / отварящи php тага???
     
    Scanolions харесва това.
  11. хейтър

    хейтър Active Member

    Рег.:
    Авг 23, 2014
    Съобщения:
    312
    Харесвания:
    97
    Точки:
    28
    То щото инак е голяма красота :D И във wp се ползва jQuery вместо $.
    Но не вземай поста ми сериозно, това е секцията на експертите като крос, дафа веб и тн.
     
    cross харесва това.

Сподели страницата

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies.
    Dismiss Notice