Replace full content with an excerpt

Decide about the_excerpt() or the_content() with a conditional: is_singular(). You can use a plugin and filter the_content depending on the current page’s type: archive or singular. But you can use it in your theme too. add_filter( ‘the_content’, ‘t5_replace_content_with_excerpt’, 100 ); /** * Return excerpt if we are not on a singular post view. * * … Read more

Does is_user_logged_in() block search bots?

If you wrap some content in a is_user_logged_in() condition, all that content will only be rendered to users who have an account on your website and are logged into that account. Now, do Google bots have an account on your website? Hell no. So no, that content will never be indexed by Google in your … Read more

Grabbing specific content

First of all learn WP_Query class. Answering on questions: (this question) How do I grab the nth element of a content type? eg. always getting the 1st or 5th most recent element from the db. $query = new WP_Query( ‘post_type=special_stuff&posts_per_page=1&paged=5’ ); List item // The Query $the_query = new WP_Query( $args ); // The Loop … Read more

wp_insert_post iframe missing

remove_filter(‘content_save_pre’, ‘wp_filter_post_kses’); remove_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’); $id = wp_insert_post( $my_post ); add_filter(‘content_save_pre’, ‘wp_filter_post_kses’); add_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’);

Change Content for Specific Page

Your function is signup but you’re hooking check_for_signup. You’re also trying to apply the_content filters from within a function that’s hooked to the_content: function wpse_225562_replace_for_signup( $content ) { if ( strcmp( ‘signup_slug’, get_post_field( ‘post_name’ ) ) === 0 ) { $content=”Sign up, bitch.”; } return $content; } add_filter( ‘the_content’, ‘wpse_225562_replace_for_signup’ ); Here we are simply … Read more

Convert all youtube link to embed

EDIT After reviewing your edit, you may want to try following These Instructions To embed a video or another object into a post or page, place its URL into the content area. Make sure the URL is on its own line and not hyperlinked (clickable when viewing the post). It sounds like you would want … Read more

Hiding posts and pages in panel

The code you posted doesn’t work because there is no global $currentpage. There are $current_screen and $pagenow. add_action( ‘pre_get_posts’, ‘wpse_63414_hide_pages’ ); function wpse_63414_hide_pages( $query ) { if( !is_admin() ) return $query; global $pagenow; $pages = array(‘2′,’26’); if( ‘edit.php’ == $pagenow && ( get_query_var(‘post_type’) && ‘page’ == get_query_var(‘post_type’) ) ) $query->set( ‘post__not_in’, $pages ); return $query; … Read more

How to just show first line of content

you could also do something like: function rt_before_after($content) { $replace = “</b>”; $shortcontent = strstr($content, $replace, true).$replace; if ($shortcontent === false) $shortcontent = $content; return $shortcontent; } add_filter(‘the_content’, ‘rt_before_after’); It should look for the first </b> in your content and return everything before that. it then adds the </b> back. The function takes that string … Read more

Site content not showing

It’s possible that someone (something) deleted all of the entries in the wp-posts table. If you are comfortable working with phpMyAdmin, you could take a peek there. It’s also possible that your current theme might be ‘borked’ for some reason. So the advice on changing to one of the ‘twenty’ themes is a good idea. … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedusedusedueduedusedueduedu