How to lock a post or page

You can use the ‘wp_insert_post_data’ filter to set the data being updated to the ones post has right now: add_filter(‘wp_insert_post_data’, ‘prevent_post_edit’, 99, 2); prevent_post_edit ($data, $postarr) { if ( ! isset($postarr[‘ID’]) || empty($postarr[‘ID’]) ) return $data; if ( current_user_can(‘edit_files’) ) return $data; // admin can edit posts // prevent the update only for post and … Read more

Allowing the SoundCloud player to appear in a post excerpt

The excerpt will only fetch the text, triming tags. You need to make a new custom field (you can use Advanced Custom Fields) for the ID of that iframe. Then, you need to edit your content_excerpt.php (I don’t know wich theme are using) and fetch that field instead or below your excerpt. For example: (using … Read more

Underscores.me retrieve next / previous post thumbnail in post_nav function

I solved the problem by using get_the_post_thumbnail() instead of the variables $prevthumbnail and $nextthumbnail. function THEMENAME_post_nav() { // Don’t print empty markup if there’s nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, ”, true ); $next = get_adjacent_post( false, ”, false ); if ( ! $next && ! … Read more

Frontend Post Excerpt field mapping

I haven’t tried the Gravity Forms plugin but if you are using the wp_insert_post function to insert the new post, you just use ‘post_excerpt’. example: $new_post = array( ‘post_title’ => ‘Post Title’, ‘post_content’ => ‘Post Content’, ‘post_status’ => ‘publish’, ‘post_excerpt’ => $custom_excerpt_field ); wp_insert_post($new_post); Not sure if I completely understand your question, so I’ve misunderstood … Read more

Show all post titles

Have not tested it but this should get you to your goal. I believe Accore LTD has it correct as well, except your slide #s will be post ID, instead of slide-1, slide-2 <div class=”content”> <?php if ( have_posts() ) : ?> <h2><?php single_cat_title(”,true); ?></h2> <div> <ul> <?php $inc = 1; while ( have_posts() ) … Read more

Post taxonomy from exif data

Retrieving attachment image EXIF data As “a plugin” won’t help later visitors, let’s start off with how to retrieve that: # Get the post ID: Use one of the following. Preferred is the API function get_the_ID() # $GLOBALS[‘post’]->ID; # global $post; $post->ID; # get_the_ID(); $meta = wp_get_attachment_metadata( get_the_ID(), false ); # Fetch the EXIF data … Read more

Show the author’s count of total amount of posts assign to a custom taxonomy term

/** * Get the author post count for a tax query. * * @link http://wordpress.stackexchange.com/q/159160/1685 * * @param array $tax_query * @return int */ function wpse_159160_get_author_posts_by_tax( $tax_query ) { global $wpdb; $where = get_posts_by_author_sql( ‘post’, true, get_post()->post_author ); $tax_query = new WP_Tax_Query( $tax_query ); $sql = $tax_query->get_sql( $wpdb->posts, ‘ID’ ); return ( int ) $wpdb->get_var( … Read more