Show posts on front page only

The is_home() conditional tag applies to the posts page according to your reading settings or home.php file as opposed to the is_front_page() conditional which applies to the page on front according to your reading settings or your front-page.php file, if it exists. Try changing is_home() to is_front_page() As for another possible problem might be, take … Read more

Exclude post category in a blog page

In your functions.php file, use pre_get_posts and swap out the -1 in the following code with the category I.D you want to exclude from your posts page. function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ );

Getting a list of the published posts

Which wp_get_recent_posts()do you retrieve the most recent posts. For meta data, like published date and modified date use additional functions. For the published date is the_date() helpful. For the modified date use the_modified_date(). The functions are a part of the Template Tags, useful for Theme and direct output. But she have also parameters to get … Read more

Why aren’t paragraphs breaking on this page?

get_the_content() returns unfiltered content, and using a shortcode you cannot use the_content() to return filtered content as you cannot echo inside a shortcode. Your best option here will be is to applying the_content filters to get_the_content(), something like: apply_filters( ‘the_content’, get_the_content() ); EDIT Exact usage, replace $output .= get_the_content(); with $output .= apply_filters( ‘the_content’, get_the_content() … Read more

How can I add 2 buttons with shortcode

If I enter this shortcode: [download url=”http://example.com”]Download[/download] it works fine. But you have to enter the link text as content yourself. You might have missed that, the way I read your question. Your [demo]-Shortcode throughs an error. To see this, you need to have WP_DEBUG set to true: Notice: Undefined variable: func in \wp-includes\shortcodes.php on … Read more

Get the post id from a plugin

One of the problems I have run into while trying to accomplish something like this is: WHEN are you trying to get this information. A lot of stuff happens in a WordPress page request. See: https://codex.wordpress.org/Plugin_API/Action_Reference If you just have the raw function in your plugin file, it will try to run when the plugin … Read more