Output custom content not from the posts table?

Basically you want custom posts in WordPress that will be just pointers to external data? If you don’t want full import then: Store some kind of unique property identifier (that makes sense for your external data) as meta field or guid in custom post type. Make wrapper function that will take ID of your custom …

Read more

Javascript Solution Remove Specific Tag but leave the rest in a specific DIV

<script type=”text/javascript”> function removeLink() { theAs = document.getElementById(‘lg_image’).childNodes; // get all children of div#lg_image for( i = 0; i < theAs.length; i++ ) { // loop through the children if( theAs[i].nodeType != 3 ) { // if the child is not a whitespace, theImg = theAs[i].innerHTML; // it is the a which contains the img, …

Read more

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