Coder Social home page Coder Social logo

ediamin / wp-bootstrap-comment-walker Goto Github PK

View Code? Open in Web Editor NEW
24.0 7.0 11.0 9 KB

A custom WordPress comment walker class to implement the Bootstrap 3 Media object in wordpress comment list.

License: GNU General Public License v2.0

PHP 100.00%

wp-bootstrap-comment-walker's Introduction

wp-bootstrap-comment-walker

A custom WordPress comment walker class to implement the Bootstrap 3 Media object in wordpress comment list.

Installation and Usage

If you haven't already add the HTML5 theme support for comment list, add this first in your functions.php

function custom_theme_setup() {
    add_theme_support( 'html5', array( 'comment-list' ) );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );

Place class-wp-bootstrap-comment-walker.php in your WordPress theme folder /wp-content/your-theme/

Open your WordPress themes comments.php file /wp-content/your-theme/comments.php and in this file you should see a snippet like this:

<ol class="comment-list">
    <?php
        wp_list_comments( array(
            'style'       => 'ol',
            'short_ping'  => true,
            'avatar_size' => 56,
        ) );
    ?>
</ol><!-- .comment-list -->

The above snippet copied from the comments.php of twentyfifteen theme. Now replace the similar code in your comments.php with this following code:

<ul class="list-unstyled">
    <?php
        // Register Custom Comment Walker
        require_once('class-wp-bootstrap-comment-walker.php');

        wp_list_comments( array(
            'style'         => 'ul',
            'short_ping'    => true,
            'avatar_size'   => '64',
            'walker'        => new Bootstrap_Comment_Walker(),
        ) );
    ?>
</ul><!-- .comment-list -->

wp-bootstrap-comment-walker's People

Contributors

bdkabiruddin avatar ediamin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-bootstrap-comment-walker's Issues

Does not seem to work?

I included the walker and added the initialization to the comments function, but it doesn't seem to work. Has this been tested in latest versions of Wordpress?

Uncaught TypeError

Hey,

I just used your code without any modifications and the reply-field is not showing upon clicking "reply".
In the console I get the following error.

comment-reply.min.js?ver=4.9.4:1 Uncaught TypeError: Cannot read property 'getElementsByTagName' of null at Object.moveForm (comment-reply.min.js?ver=4.9.4:1) at HTMLAnchorElement.onclick (VM13364:484)

I enqued the comment-reply.js like so:

function theme_queue_js(){ if ( (!is_admin()) && is_singular() && comments_open() && get_option('thread_comments') ) wp_enqueue_script( 'comment-reply' ); } add_action('wp_print_scripts', 'theme_queue_js');

Am I missing something there? Help is appreciated. Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.