Viewing 12 replies - 1 through 12 (of 12 total)
  • You don’t need the page.php. You can change the custom-page.php of your child-theme (so copy the parent custom-page.php in your child-theme folder and modify it) and select it as template for you wpdeals pages.
    That said, I gave a look at this wpdeals.. well it shares a lot with woocommerce, for which customizr is compatible.
    So you can do this instead of changing templates and other stuff like that.. just add the code below in your child-theme functions.php :

    add_action('after_setup_theme', 'wp_deals_comp', 50);
    function wp_deals_comp(){
        if ( ! is_plugin_active('wp-deals/wpdeals.php') )
            return;
    
        // unhook wp deals wrapper
        remove_action('wpdeals_before_main_content', 'wpdeals_output_content_wrapper', 10 );
        remove_action('wpdeals_after_main_content', 'wpdeals_output_content_wrapper_end', 10 );
    
        // hook customizr wrapper and action hooks
        add_action('wpdeals_before_main_content', 'tc_wpdeals_wrappers');
        add_action('wpdeals_after_main_content', 'tc_wpdeals_wrappers');
    
        function tc_wpdeals_wrappers() {
            switch ( current_filter() ) {
              case 'wpdeals_before_main_content':
    
              ?>
                <div id="main-wrapper" class="<?php echo tc__f( 'tc_main_wrapper_classes' , 'container' ) ?>">
    
                <?php do_action( '__before_main_container' ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)...and whatever you need! ?>
    
                <div class="container" role="main">
                    <div class="<?php echo tc__f( 'tc_column_content_wrapper_classes' , 'row column-content-wrapper' ) ?>">
    
                        <?php do_action( '__before_article_container'); ##hook of left sidebar?>
    
                            <div id="content" class="<?php echo tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'class' ) ?> article-container">
    
                                <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?>
              <?php
    
                break;
    
              case 'wpdeals_after_main_content':
              ?>
                                <?php do_action ('__after_loop');##hook of the comments and the posts navigation with priorities 10 and 20 ?>
    
                            </div><!--.article-container -->
    
                        <?php do_action( '__after_article_container'); ##hook of left sidebar?>
    
                    </div><!--.row -->
                </div><!-- .container role: main -->
    
                <?php do_action( '__after_main_container' ); ?>
    
              </div><!--#main-wrapper"-->
    
              <?php
                break;
            }//end of switch on hook
            ?>
            <?php
        }//end of nested function
    
        //handles the wpdeals sidebar: removes action if sidebars not active
        if ( ! is_active_sidebar( 'deals' ) ) {
            remove_action( 'wpdeals_sidebar', 'wpdeals_get_sidebar', 10 );
        }
    
        //disables post navigation
        add_filter( 'tc_show_post_navigation', 'tc_wpdeals_disable_post_navigation' );
        function tc_wpdeals_disable_post_navigation($bool) {
            return ( function_exists('is_wpdeals') && is_wpdeals() ) ? false : $bool;
        }
    
        //removes post comment action on after_loop hook
        add_filter( 'tc_show_comments', 'tc_wpdeals_disable_comments' );
        function tc_wpdeals_disable_comments($bool) {
            return ( function_exists('is_wpdeals') && is_wpdeals() ) ? false : $bool;
        }
    }

    This is exactly the same code customizr uses for woocommerce compatibility (just adapted, changing functions and hooks names).
    I’ve made a small tests and works pretty fine.
    Just add also this on your custom css:

    .deals-description {
        clear: both;
    }

    Thread Starter ibogo

    (@ibogo)

    It did not do anything.

    I pasted the above code into functions.php (don’t have child-theme) and Custom CSS respectively.

    Also, right sidebar was activated. I removed that and still nothing changed.

    You shouldn’t do it.
    Who talked about sidebars? 🙂
    Is this the plugin we’re talking about? https://ww.wp.xz.cn/plugins/wp-deals/
    If yes, please paste the whole content of your functions.php in pastebin and then paste the link here. ‘Cause that code works, I tested it as I said.

    Also I still don’t get why you don’t wanna use a child theme. A child theme inherits all the options you set in the parent theme. The only thing you have to set again is the menu, just select it again, not build it from the start.
    Also, whatever you change in the parent theme files will be lost with a theme update.

    But it’s your choice.

    Thread Starter ibogo

    (@ibogo)

    You are probably right; I will look into getting a child theme.

    As for the plugin you can find it here: https://ww.wp.xz.cn/plugins/deals-engine

    Btw the css part isn’t applied ’cause you have this in your custom css:

    /*Current page menu item*/
    .navbar .nav > li.current-menu-item > a{
        color: #7EC247;
        background: #000000;
    
    .deals-description {
        clear: both;
    }

    as you can see a closing bracket is missing before .deals-description .
    So wanna share your functions.php so we can see why doesn’t work for you?

    Thread Starter ibogo

    (@ibogo)

    To clarify; this plugin is called “Social Deals Engine”, not “WP Deals” (that is a different one).

    Here is functions.php (with beginning and end Customizr text removed): http://pastebin.com/u1SgQPz6

    EDIT: Also, the CSS still doesn’t change anything with closing bracket added (but thanks for letting us know).

    @ibogo
    let me clear you one thing:

    /*Current page menu item*/
    .navbar .nav > li.current-menu-item > a{
        color: #7EC247;
        background: #000000;
    
    .deals-description {
        clear: both;
    }

    That is wrong, this is good:

    /*Current page menu item*/
    .navbar .nav > li.current-menu-item > a{
        color: #7EC247;
        background: #000000;
    }
    .deals-description {
        clear: both;
    }

    Now, you say doesn’t change anything ’cause you have other problems, but it changes something.
    That said, fine you’re using another plugin, let’s see what can we do to make it compatible with customizr.
    So I presume is this right? https://ww.wp.xz.cn/plugins/deals-engine/

    Always presuming that is the plugin you are using, here’s the code:

    add_theme_support('wpsdeals');
    add_action('after_setup_theme', 'wpsdeals_comp', 50);
    function wpsdeals_comp(){
        if ( ! is_plugin_active('deals-engine/deals-engine.php') )
            return;
    
        // unhook wp deals wrapper
        remove_action('wps_deals_before_main_content', 'wps_deals_output_content_wrapper', 10 );
        remove_action('wps_deals_after_main_content', 'wps_deals_output_content_wrapper_end', 10 );
    
        // hook customizr wrapper and action hooks
        add_action('wps_deals_before_main_content', 'tc_wpsdeals_wrappers');
        add_action('wps_deals_after_main_content', 'tc_wpsdeals_wrappers');
    
        function tc_wpsdeals_wrappers() {
            switch ( current_filter() ) {
              case 'wps_deals_before_main_content':
    
              ?>
                <div id="main-wrapper" class="<?php echo tc__f( 'tc_main_wrapper_classes' , 'container' ) ?>">
    
                <?php do_action( '__before_main_container' ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)...and whatever you need! ?>
    
                <div class="container" role="main">
                    <div class="<?php echo tc__f( 'tc_column_content_wrapper_classes' , 'row column-content-wrapper' ) ?>">
    
                        <?php do_action( '__before_article_container'); ##hook of left sidebar?>
    
                            <div id="content" class="<?php echo tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'class' ) ?> article-container">
    
                                <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?>
              <?php
    
                break;
    
              case 'wps_deals_after_main_content':
              ?>
                                <?php do_action ('__after_loop');##hook of the comments and the posts navigation with priorities 10 and 20 ?>
    
                            </div><!--.article-container -->
    
                        <?php do_action( '__after_article_container'); ##hook of left sidebar?>
    
                    </div><!--.row -->
                </div><!-- .container role: main -->
    
                <?php do_action( '__after_main_container' ); ?>
    
              </div><!--#main-wrapper"-->
    
              <?php
                break;
            }//end of switch on hook
            ?>
            <?php
        }//end of nested function
    
        //handles the wpdeals sidebar: removes action if sidebars not active
        if ( ! is_active_sidebar( 'deals' ) ) {
            remove_action( 'wps_deals_sidebar', 'wps_deals_get_sidebar', 10 );
        }
    
        //disables post navigation
        add_filter( 'tc_show_post_navigation', 'tc_wpsdeals_disable_post_navigation' );
        function tc_wpsdeals_disable_post_navigation($bool) {
            return (  is_single() && get_post_type() == WPS_DEALS_POST_TYPE ) ? false : $bool;
        }
    
        //removes post comment action on after_loop hook
        add_filter( 'tc_show_comments', 'tc_wpdeals_disable_comments' );
        function tc_wpdeals_disable_comments($bool) {
            return (  is_single() && get_post_type() == WPS_DEALS_POST_TYPE ) ? false : $bool;
        }
    }

    Basically the same code, just some function name changed and a different condition to show or not comments/navigation, since they don’t have something like is_deals.
    You can avoid the css part.

    Hope this helps

    p.s.
    you have to replace to first code I gave you with this one.

    Hey @ibogo
    you know what? There must have been an issue on this forum, for example I couldn’t see this when I replied about the css rule not applied. 🙂

    Thread Starter ibogo

    (@ibogo)

    Just to clear up, we added the closing bracket to that CSS before (as you advised), but it wasn’t working because php was for wrong plugin.

    ANYWAY;

    This works! That info is no longer showing. 🙂 😀

    Thank you once again. 🙂

    Thread Starter ibogo

    (@ibogo)

    [Resolved]

    Ah, no I have to explain it better.
    That css was to solve a little weird behavior of that other plugin. And closing that bracket made that CSS code work. I inspected your page and it was working, when you added that bracket, but you cannot see any real difference because of the fact that the whole important part was for another plugin. 🙂
    Basically, for the plugin I was testing, the deal description wasn’t “well placed” in the page. Your plugin looks better.
    But you know what? They use similar code, similar or same classes for their html elements. Your plug-in has the same div with the same class (“deals-description”). That is one of the reason why I made the first code, I thought it was your plug-in ’cause I could experience the same “wrong” behaviour overall, and could find the same elements in the page (or pretty much) 😀
    Anyway .. we made it 😉

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘page.php’ is closed to new replies.