[resolved] functions.php corrupt (4 posts)

  1. Bielco
    Posted 1 year ago #

    the brightnews/functions.php seems to be corrupt...

    on line 68 there is a php if construction that is not valid....

    function brightnews_scripts_styles() {
    	global $wp_styles;
    	// Adds JavaScript
    	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )

    This is not a valid if construction and when you use an ide that reports...

    expecting statement, which is correct.

    Furthermore on line 369 there is this code...

    function brightnews_button_shortcode($atts, $content = null) {
       extract(shortcode_atts(array('link' => '#'), $atts));
       return '<a class="custom-button" href="'.$link.'">' . do_shortcode($content) . '</a>';

    $link is not available in the function, you can fix this by passing the link to the function, or to call global $link in the function.

  2. Tomas Toman
    Theme Author

    Posted 1 year ago #

    Dear Bielco,

    the first code (on line 68) is used for calling the comment-reply script for threaded comments:

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
    		wp_enqueue_script( 'comment-reply' );

    There are more possibilities how to define a condition in PHP and this is one of the solutions. You can see the same construction also in Twenty Twelve theme (for example).

    The second code is used for custom button shortcode. As this feature is rather plugin than theme territory, I am considering to remove it with the future updates. But as you can see in the Codex, this solution is fully functional.

    In any case, thank you for your notices!
    Tomas Toman

  3. Bielco
    Posted 1 year ago #

    Ah that makes sense, thanks for the reply.

  4. Tomas Toman
    Theme Author

    Posted 1 year ago #

    You're welcome!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic