Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • Forum: Hacks
    In reply to: Conditional Statements

    Oh, I see the problem. I missed an ending parenthesis in my code sample. Just change that line to this:

    if ( !is_single( '3949' ) ) {

    and it should work fine. Sorry about that.

    Forum: Hacks
    In reply to: Conditional Statements

    Did you replace if ( !is_single( 'yourpostid' ) with the post id of the news post you are targeting?

    Also, if you change the debug line in your wp-config.php from define('WP_DEBUG', false); to define('WP_DEBUG', true); it may tell you what the error is.

    Could you please post a link to your site and I can take a look?

    You have two options depending on what you want to do. If you want to get all the posts of the author of every type, you can simply remove the post_type paramater from the $args array like so:

    $args = array(
    	'author' => $curauth->ID
    );

    and it will return all the posts of the author. However, it sounds like you want to find all the user’s posts of your custom post types (“get the count for all of his posts from all our post types “). You can do this by listing all of your custom post types in an array, and it will return all the posts of all of those specific types:

    $args = array(
    	'author' => $curauth->ID,
    	'post_type' => array(
    		'custom1',
    		'custom2',
    		'custom3'
    	)
    );
    Forum: Hacks
    In reply to: Conditional Statements

    You should be able to use this, replacing yourpostid with the ID of the news post on which you want this specific custom text to appear.

    <?php
    /**Displaying Custom Field Data**/
    	$featuredtext = get_post_meta( $post->ID, 'featured-text', true );
    	if( ! empty( $featuredtext ) && ! is_search() ) {
    		foreach( $featuredtext as $text)
    		{
    		    echo '<div class="banner-text"><span>'.$text['featured-image-text'].'</span></div>';
    		}
    	} elseif ($current_posttype == 'products' || is_search()) {
    				echo '<div class="banner-text"><span>' . get_option('prodFeaturedText') . '</span></div>';
    	} elseif ($current_posttype == 'people') {
    				echo '<div class="banner-text"><span>' . get_option('peopleFeaturedText') . '</span></div>';
    	} elseif ($current_posttype == 'news') {
    		if ( !is_single( 'yourpostid' ) {
    			echo '<div class="banner-text"><span>' . get_option('newsFeaturedText') . '</span></div>';
    		} else {
    			echo '<div class="banner-text"><span>This is the custom text for your specific news post.</span></div>';
    		}
    	}
    ?>

    It sounds like the tiny dots are probably being generated because of <li> elements in the ShareThis HTML. If you provide a link to the page it’s showing up on, I can tell you the CSS to use to remove them.

    You can add this code

    function my_search_query( $query ) {
    	// not an admin page and is the main query
    	if ( !is_admin() && $query->is_main_query() ) {
    		if ( is_search() ) {
    			$query->set( 'orderby', 'date' );
    		}
    	}
    }
    add_action( 'pre_get_posts', 'my_search_query' );

    to your functions.php file, as referenced here.

    I’m sorry, but nobody will be able to view the post you linked to because it is a preview. You will have to publish it if you want people to be able to see this page.

Viewing 8 replies - 16 through 23 (of 23 total)