Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter phantom001

    (@phantom001)

    Also if i call absolut nothing …
    No comments_template()
    No require or something else at the end of my single.php to point to my comments.

    If the comments are open and the post have noc comments wp displays alsways the standard form ….

    So i call nothing by my self or by theme wp will display it automatically 🙁
    (Why? Where?)

    My single.php without the comment section lokks like this:

    <?php get_header(); ?>
    <div class="post">
    <div class="post_bg">
    <div class="post_cont">
    <?php  the_post(); ?>
    <div class="post_meta">
    <?php the_date(); ?><br/>
    </div>     
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>    
    </div>      
    </div>
    </div>
    <?php get_footer(); ?>

    If i open a post where comments active and with comments in it nothing gets displayed.
    (yeh its right there is nothing to display without the comments code in single.php)

    If i open a post where comments active and no comments it displays the comment form ??

    I also have the same behavior when i load the standard twenty twenty wp theme …

    I dont get it *gg*

    • This reply was modified 3 years, 10 months ago by phantom001.
    • This reply was modified 3 years, 10 months ago by phantom001.
    Thread Starter phantom001

    (@phantom001)

    @bcworkz

    Thanks again 🙂

    I designed the theme from scratch by my self the only thing that is missing is the comments part so i know that there is no code somewhere in the theme that hook in the comments …

    You are right normally you call the comments_template() function and this function load the comments.php and the comments-template but if we have a closer look this function does nothing if there are no comments in the post.
    WordPress reference

    It say it clear in the description and also if you look at the first if then you see that when the post has not a single comment it just returns:

       if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) {
            return;
        }

    So the comments.php wont get loaded … because the function does nothing.

    BUT

    If the comments are open in a post and there is not a single comment a standard comment form gets displayed

    So i call comments_template() function in my single.php this function just returns and does nothing because there is no single comment … where did the standard comment form comes from ??? (must be a word press standard)

    I see two ways to get what i want …

    1. get the comments_template() function to load also if there no comments in the post
    It works when i change it but i dont want do change core files maybe there is a other way.

    2. I find out where this standart form come from when there is no comment in the post and hook in there …

    Thank you 🙂

    • This reply was modified 3 years, 10 months ago by phantom001.
    Thread Starter phantom001

    (@phantom001)

    @bcworkz

    Than you for your help again.

    What i try to get:
    I have two tabs in my comment.php one holds the comments the other the form for post and answer … this works fine.

    My problem starts if comments are open and there is not at least one comment.

    Here i also want that the tabs (comment.php) gets displayed with the form tab activated “Post the first comment … “.

    So i just want to handle the “comments are open but there is no comment” case inside the comments.php

    But there is some function/hook that prevent me from do that …

    Also when i call the comments.php direct per require() in single.php i have the same issue:

    In the Post with comments the comment.php gets displayed (without comments because i miss some functions from the comments_template() function but thats not the point ..)

    In the Post without comments (but comments are open) i get displayed the standard from so the comments.php wont get loaded at all 🙁

    As said i think there is somewhere a function that say:
    If in the post comments are open dont load the comments.php just display the form.

    And this behavior i try to change to … also point to comments.php …

    But i dont find the point to hook in …
    All i figured out is that it has nothing do to with the comments.php and also not realy with the comments_template(); function because when i call comments.php without it directly over require i have the same issue …

    Thank you 🙂

    Thread Starter phantom001

    (@phantom001)

    I have tried in single.php :

     if ( comments_open() || get_comments_number() ) :
        global $withcomments;
        $withcomments = 1;
        comments_template();
     endif;

    But sadly with no success 🙁

    Thread Starter phantom001

    (@phantom001)

    @bcworkz

    THANK YOU for pointing me in the right direction !!

    I have also:

    if ( comments_open() || get_comments_number() ) {
    		comments_template();
    	}

    In my single.php and when i have a look at comment-template.php in the first If says (among other) !$withcomments and return; so its logical that the comments.php wont get loaded.

    My solution was to change …

    Sorry if someone read my solution sad to say it was nonesense 🙁

    So i know why my comments.php wont get loaded because its the if in the comment-template.php …

    Is there a way to override that ?
    I would like to handle the no post case also in my comments.php

    Thank you !

    • This reply was modified 3 years, 10 months ago by phantom001.
    • This reply was modified 3 years, 10 months ago by phantom001.
    • This reply was modified 3 years, 10 months ago by phantom001.
    Thread Starter phantom001

    (@phantom001)

    @weboccults
    Sure !
    Sorry that i dont privide it in the first post because i see that it wont get loaded at all if i check the output html there is no trace of it.

    Please ignore the have_comments() if i have insert it because first i thougt maybe it would make a difference (code with comments / code without comments)

    <?php
    if ( post_password_required() )
        return;
    ?>
    
    <?php if ( comments_open() && get_comments_number() ) :
    
    if ( have_comments() ) { ?>
    
    <?php
    $comqstr = '';
    $comtab = '';
    $formtab = '';
    $replyto = '';
    
    //$replyto = $_GET['replytocom'];
    
    $queries = array();
    parse_str($_SERVER['QUERY_STRING'], $comqstr);
    
    if (array_key_exists("replytocom",$comqstr))
      {
    $replyto = $comqstr["replytocom"];
      }
    
    if ($replyto != '') {
    $comtab = '';
    $compane = '';
    $formtab = 'active';
    $formpane = 'show active';
    }  else {
    $comtab = 'active';
    $compane = 'show active';
    $formtab = '';
    $formpane = '';
    }
    
    ?>
    
    <!-- Tabs -->
    <section id="womo_comtabs">
    
        <nav>
            <div class="nav nav-tabs nav-fill .womo_com_tab" id="nav-tab" role="tablist">
                <a class="nav-item nav-link womo_comtab_class <?php echo $comtab; ?>" id="womo_comtab_comtab" data-toggle="tab" href="#nav-com" role="tab" aria-controls="nav-comt" aria-selected="true">Kommentare</a>
                <a class="nav-item nav-link womo_comtab_class <?php echo $formtab; ?>" id="womo_comtab_formtab" data-toggle="tab" href="#nav-form" role="tab" aria-controls="nav-form" aria-selected="false">Kommentar schreiben</a>
            </div>
        </nav>
        <div class="tab-content" id="nav-tabContent">
    
            <div class="tab-pane fade <?php echo $compane; ?>" id="nav-com" role="tabpanel" aria-labelledby="nav-home-tab">
    
                <ul class="comment-list comments">
                    <?php
                wp_list_comments( array(
                'style'      => 'ul',
                'short_ping' => true,
                'callback' => 'womo_comments'
                ) );?>
                </ul>
    
            </div>
    
            <div class="tab-pane fade <?php echo $formpane; ?>" id="nav-form" role="tabpanel" aria-labelledby="nav-profile-tab">
    
                <div class="womo-comments-form">
                    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
                        <div class="womo-comments-form-row">
                            <div class="womo-comments-form-label">
                                <label for="author">Name</label>
                            </div>
                            <div class="pc_field_container">
                                <input type="text" class="womologin-input" name="author" value="<?php echo $comment_author; ?>" maxlength="30" size="30">
                            </div>
                        </div>
    
                        <div class="womo-comments-form-row">
                            <div class="womo-comments-form-label">
                                <label for="email">Email</label>
                            </div>
                            <div class="pc_field_container">
                                <input type="text" class="womologin-input" name="email" value="<?php echo $comment_author_email; ?>" maxlength="30" size="30">
                            </div>
                        </div>
    
                        <div class="womo-comments-form-row">
                            <div class="pc_field_container">
                                <textarea class="womologin-textarea" name="comment" id="comment" style="width: 100%;" rows="10" tabindex="4"></textarea>
                            </div>
                        </div>
    
                        <div class="womo-comments-form-btndiv">
                            <input class="womo-comments-form-btn" name="submit" type="submit" id="submit" tabindex="5" value="Senden" />
                            <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
                        </div>
    
                        <?php do_action('comment_form', $post->ID); ?>
    
                    </form>
                </div>
    
            </div>
    
        </div>
    
    </section>
    
    <?php } else { ?>
    
    NO COMMENTS
    
    <?php
    } endif; ?>

    Thank you for your Help !

    • This reply was modified 3 years, 10 months ago by James Huff.
    • This reply was modified 3 years, 10 months ago by phantom001.

    Hello,

    Sorry i am in work so my answer may be is a little bit short …
    (Cant explain it in the detail at the moment)

    The good news:
    Now i see what you want do to 🙂

    The bad news:
    The images in this case are not simple background images there is a little bit more css behind them.

    My english is not the best but i try to explain whats going on:
    In your case to keep it simple we have in the basic 3 types of div layers.
    1. Text with no background (you can look through)
    2. Text with background color (you cant look through)
    3. A Image Div.

    The Image Div is fixed in the background.

    The other layers lay on top (over the Image div) and they are scrollable.

    Text with background color
    Text with no background
    Text with background color

    So now if you scroll the divs in front you can see the fixed backgorund image through the divs with no background color.

    Just like:
    Take a piece of paper cut a square in it.
    Now take a image and put the paper on top of it.
    Slide the paper up and down …

    As I said i cant explain the code side at the moment but try this:

    open the main.css
    search for .home-inner and replace it with:

    
    .home-inner {
        background-image: url('../img/computers.png');
    }
    

    open the fixed.css:
    search for .home-inner and replace it with:

    
    .home-inner {
     position: fixed;
      display: block;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-size: cover;
      background-position: center center;
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
      will-change: transform;
    }
    

    Now you should see the backgroundimage.

    Greetings
    Patrick

    I just looked closer on your code example ….

    If you want the backgroundimage span the section given in html like:
    <!– Start of Landing Page Image –>
    <!– End of Landing Page Image –>

    You should hook the image to the landing and not to the home-inner class …

    See here

    Hello,

    Without to see how the site react its a little bit difficult in that case …

    But when i get you right you just want a landig page image !?
    So a backgroundimage over the complete viewport ?

    When i am right you should anchor it in the head section of your site.
    Or much easier simply use the html::before css selector for it.

    This should give you a background image over/behind the whole Site:

    
    html::before {
    content: ' ';
    display: block;
    background-image: url(background.jpg);
    background-position: center center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 100vh;
    width: 100vw;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    position: fixed;
    z-index: -10; // This is pretty important.
    }
    

    Greetings
    Patrick

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