Displaying latest Posts – fixed height – Excerpt vs. Content?

The simple way to do this is to define the height/width in CSS of a container, and then apply a trim on the excerpt. To change default excerpt length add this to you functions.php function new_excerpt_length($length) { return 100; // change this to how many any characters you want } add_filter(‘excerpt_length’, ‘new_excerpt_length’); Manually controlling the … Read more

Stripping the_content() from images then displaying them seperately

maybe use this regex: $pattern = “/<a(.*?)href=(‘|\”)([^>]*)(‘|\”)(.*?)><img(.*?)src=(‘|\”)([^>]*).(bmp|gif|jpeg|jpg|png)(‘|\”)(.*?)class=(‘|\”)([^>]*)(‘|\”)(.*?)\/><\/a>/i”; function example_replace ($content) { global $post; $pattern = “/<a(.*?)href=(‘|\”)([^>]*)(‘|\”)(.*?)><img(.*?)src=(‘|\”)([^>]*).(bmp|gif|jpeg|jpg|png)(‘|\”)(.*?)class=(‘|\”)([^>]*)(‘|\”)(.*?)\/><\/a>/i”; $replacement=”<a$1href=$2$3$4$5><img$6src=$7$8.$9$10$11class=$12$13 <strong>imagelink</strong>$14$15$16/><\/a>”; $content = preg_replace($pattern, $replacement, $content); return $content; }

Add Word Limit to Posts

You can limit is through a filter on the_content For example (in functions.php): add_filter(“the_content”, “Content_Filter_Custom”); function Content_Filter_Custom($content) { // return a subset of it return substr($content, 0, 300); }

How to get rid of shortcodes in post content once and for all

Please backup your database before trying In your current theme, open the functions.php file and add the code below. In theshortcodeyouhate inform the shortcode you want to get rid of, note that even extended types works nicely! Once you added this code, hit F5 and you are done. add_action (‘init’,’remove_shortcode_from_db’); //you can choose any other … Read more

How can I automatically insert the page content as the title?

I think save_post action hook is the proper one. Maybe you’ll want to insert some checking if the post title is already set ($post_object->post_title), as this code always update the title according to the content. add_action( ‘save_post’, ‘save_post_wpse_87921’, 10, 2 ); function save_post_wpse_87921( $post_id, $post_object ) { // Auto save? if ( defined( ‘DOING_AUTOSAVE’ ) … Read more

same wordpress, 2 domains

There are two options to run multiple sites from one installation: Use multi-site with a subdomain setup. You can use completely different domains then. Adjust the site URL depending on the currently requested host.