Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter thatgoodlookingguy

    (@thatgoodlookingguy)

    Wow, thanks for that thorough explanation. Nice and easy to understand and it solved my problem. I can’t thank you enough, thanks a bunch!

    Thread Starter thatgoodlookingguy

    (@thatgoodlookingguy)

    <?php
    /**
     * Custom template tags for this theme.
     *
     * Eventually, some of the functionality here could be replaced by core features
     *
     * @package big-brother
     */
    
    if ( ! function_exists( 'big_brother_content_nav' ) ) :
    /**
     * Display navigation to next/previous pages when applicable
     */
    function big_brother_content_nav( $nav_id ) {
    	global $wp_query, $post;
    
    	// Don't print empty markup on single pages if there's nowhere to navigate.
    	if ( is_single() ) {
    		$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
    		$next = get_adjacent_post( false, '', false );
    
    		if ( ! $next && ! $previous )
    			return;
    	}
    
    	// Don't print empty markup in archives if there's only one page.
    	if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) )
    		return;
    
    	$nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation';
    
    	?>
    	<nav role="navigation" id="<?php echo esc_attr( $nav_id ); ?>" class="<?php echo $nav_class; ?>">
    		<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'big-brother' ); ?></h1>
    
    	<?php if ( is_single() ) : // navigation links for single posts ?>
    
    		<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'big-brother' ) . '</span> %title' ); ?>
    		<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'big-brother' ) . '</span>' ); ?>
    
    	<?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?>
    
    		<?php if ( get_next_posts_link() ) : ?>
    		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'big-brother' ) ); ?></div>
    		<?php endif; ?>
    
    		<?php if ( get_previous_posts_link() ) : ?>
    		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'big-brother' ) ); ?></div>
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	</nav><!-- #<?php echo esc_html( $nav_id ); ?> -->
    	<?php
    }
    endif; // big_brother_content_nav
    
    if ( ! function_exists( 'big_brother_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function big_brother_posted_on() {
    	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) )
    		$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
    
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    	);
    
    	printf( __( '<span class="posted-on">%1$s</span> <span class="byline">%2$s</span>', 'big-brother' ),
    		sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
    			esc_url( get_permalink() ),
    			$time_string
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			esc_html( get_the_author() )
    		)
    	);
    }
    endif;
    
    /**
     * Returns true if a blog has more than 1 category
     */
    function big_brother_categorized_blog() {
    	if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
    		// Create an array of all the categories that are attached to posts
    		$all_the_cool_cats = get_categories( array(
    			'hide_empty' => 1,
    		) );
    
    		// Count the number of categories that are attached to the posts
    		$all_the_cool_cats = count( $all_the_cool_cats );
    
    		set_transient( 'all_the_cool_cats', $all_the_cool_cats );
    	}
    
    	if ( '1' != $all_the_cool_cats ) {
    		// This blog has more than 1 category so big_brother_categorized_blog should return true
    		return true;
    	} else {
    		// This blog has only 1 category so big_brother_categorized_blog should return false
    		return false;
    	}
    }
    
    /**
     * Flush out the transients used in big_brother_categorized_blog
     */
    function big_brother_category_transient_flusher() {
    	// Like, beat it. Dig?
    	delete_transient( 'all_the_cool_cats' );
    }
    add_action( 'edit_category', 'big_brother_category_transient_flusher' );
    add_action( 'save_post',     'big_brother_category_transient_flusher' );
    
    /**
     * Returns the URL from the post.
     *
     * @uses get_the_link() to get the URL in the post meta (if it exists) or
     * the first link found in the post content.
     *
     * Falls back to the post permalink if no URL is found in the post.
     *
     * @return string URL
     */
    function big_brother_get_link_url() {
    	$content = get_the_content();
    	$has_url = get_url_in_content( $content );
    
    	return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
    }

    Sorry for taking up your time, I don’t anything about programming. Is this the right file?

    thatgoodlookingguy

    (@thatgoodlookingguy)

    Sorry for being a noob ^_^ thanks for the help.

    thatgoodlookingguy

    (@thatgoodlookingguy)

    Oh right, sorry. I just googled my problem and this was the first result. I didn’t realize this was a specific plug in. I think I’m just using the default word press one.

    thatgoodlookingguy

    (@thatgoodlookingguy)

    I hate to bump an old topic but I am having the same problem. I assume English is not their first language so I will help elaborate. When you try and put a link inside the Accordion description it wont display the text or the link.

    This is the code I use

    [accordion accordion1heading="Volume 1" accordion1content="<a href="http://christoenzo.com/the-lords-son/chapter-1/">Chapter 1 - Every mans humble beginning</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-2/">Chapter 2 - The land of blue & silver</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-3/">Chapter 3 - Blue Silver Sheep</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-4/">Chapter 4 - The glutton's climb</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-5/">Chapter 5 - Banquet of the raging bull</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-6/">Chapter 6 - There's no such thing as a kind person</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-7/">Chapter 7 - War Gods Domain</a>
    
    <a href="http://christoenzo.com/the-lords-son/chapter-8/">Chapter 8 - The inheritance</a>" accordion2heading="Volume 2" accordion2content="N/A" accordion3heading="Volume 3" accordion3content="N/A" accordion4heading="Volume 4" accordion4content="N/A" accordion5heading="Volume 5" accordion5content="N/A"]

    So I don’t know if the coding is wrong or something else but I assume that we have the same problem.

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