Articles of formatting

Changing the code format for wordpress

So I have the following code: global $userpro; $output .= ‘<div class=”mainpageauthor”>’; $output .= ‘<a href=”‘.$userpro->permalink($post->post_author).'”>’.get_the_author_meta(‘display_name’,$post->post_author).'</a>’; $output .= ‘</div>’; How would I change it to html php format? (I am not sure if I am asking it correctly). For example, I tried to change it but I am not sure if it is correct: <div […]

Selectively remove empty line after line change

In WP post editor, how can I change lines without adding an empty line? I try to post this One line Second line third line But it always shows like this One line Second line Third line PS: I don’t want to completely remove wpautop, because it will probably ruin all my previous posts.

Calling PHP Titles inside Javascript Markup

I have a video gallery, and all the titles are generated by php. They are coming from my WordPress media library’s attachment titles. The lightbox for these videos, however, is customized in javascript. How can I put the php titles inside the iframe markup? PHP – need to use $attachment_data[‘title’]: <?php $the_query = new WP_Query(array( […]

Trim content without stripping formatting

I’ve tried <?php $trimmed = wp_trim_words( get_the_content(), 55, “” ); ?> <?php echo $trimmed; ?> and <?php $trimmed = wp_trim_words( the_content(), 55, “” ); ?> <?php echo $trimmed; ?> the second option with the_content does not work as expected. Some posts have a video in the content and when the formatting is stripped the embed […]

Editing the formatting.php file vs functions.php file?

I’d like to format the time-ago date format from 5 min to 5m. I can edit the formatting.php file and make the edit but should I? Should I instead declare the edit in the functions.php file? From the formatting.php file: function human_time_diff( $from, $to = ” ) { if ( empty( $to ) ) { […]

Formatting poetry in wordpress

I am (a novice) editing a poetry blog. Poetry has weird spacing, and I can’t get any combination of code to do what I need. For example, one poem needs to be single spaced, but it also needs an indentation on specific lines. Example: This is the first line of the poem, then the next […]

How to Prevent WordPress from Automatically Applying Inline Styles to Post Images?

I am wondering how to prevent WordPress from applying in-line styles to image enclosing div’s in posts. <div class=”img size-medium wp-image-3267 alignright” style=”width:190px;”> Edit: The post is generated in the theme file by using the_content(). That width declaration is causing my post to display a horizontal scrollbar under the content. The weird thing is, the […]

Displaying Meta-Box Data Properly

Quick and dirty, I have meta boxes pertaining to concert information. (i.e. venue and location) and am trying to figure out how to properly display them in my post. At the moment to display the meta-box data I have <?php $venue_info = get_post_custom_values(“venue_info”); if (isset($venue_info[0])) { }; ?> <?php if( $venue_info[0] ) : ?> <?php […]

Display KML (or other “raw data” file) nicely in WP?

I want to display this file: on, but all my attempts fail because of preprocessing: (use “view source” to see what parts of the file WP “hides” from view).

WordPress no longer holding post formatting

When creating a new post, by entering either manually or pasting from another document, TinyMCE (the default WordPress editor) does not seem to hold any type of formatting. For instance I create a two paragraph entry. When viewing it on the page it will come through as a single chunk of text within <div class=”entry-content”>. […]