Tag Info

Hot answers tagged

24

here's what we did yesterday on a client site that we were having this exact problem with... I created a quick filter as a plugin and activated it. <?php /* Plugin Name: Image P tag remover Description: Plugin to remove p tags from around images in content outputting, after WP autop filter has added them. (oh the irony) Version: 1.0 Author: Fublo Ltd ...


10

Basically you need to make WordPress treat img like block-level element for the purpose of formatting. Such elements are hardcoded in wpautop() and list is unfortunately not filtered. What I would do is: Fork wpautop() under different name. Add img to regexp in $allblocks variable. Remove wpautop from the_content filter. Add your forked version to ...


10

The best way is without plugin - i set WP3.0 with multisite; the first blog is a dummy to rewrite the uesers to right blog with his language, a small script in the theme to rewirte ro the right language; i see in the browser-language of the users and rewrite; the second is the default blog, the third blog is another blog and so on - olso it is possible to ...


8

Not exactly sure what you are trying to accomplish, but it looks like you are trying to prepend something to the beginning of the_content. Try this: add_filter('the_content', 'se24265_my_function'); function se24265_my_function( $content ) { $write = 'hello world'; $new_content = $write . $content; return $new_content; } Most filters will ...


7

Typically you use widgets or custom post types but in reality these solutions can be unfriendly to clients. WordPress still revolves around the idea of a post based loop so doing traditional "content blocks" that you might find in other frameworks can be difficult. Fortunately there are plugins that are pretty good in this area. I recommend checking out ...


7

You might want to consider creating a Custom Post Type for this product (I assume it's some sort of product), and then adding custom metaboxes, that will store the custom data (specs, features, etc.) as metadata for each Post. Then, your custom template file becomes "single-.php" (e.g. "single-product.php"), and you can structure the markup however you ...


7

I always use the Theme Unit Test that Theme Reviewers use to evaluate themes for the Repo. It's got pretty much everything you need to style/worry about. And if I need to create batch content in a different way, then I use WP Dummy Content


7

Caution: very mac/linux/unix centric thoughts ahead. Includes a lot of command line fu. Put All the Code Under Version Control I like git. Mark Jaquith has some good suggestions on keeping an entire site under version control using git and submodules for the WordPress core. You could also put plugins in as git submodules. The developer end of the team ...


6

Your sites look nothing alike. Open those three links - and there is not a single element that binds all three sites together. Network of sites can benefit from consistent looks. You could use global "about" page that covers all of your activity and not just bits in context of specific site. Consider building landing page that will summarize yourself, your ...


6

If it is a strict structure, you might be better off creating a custom post type. You would then store the name in the title field, the image as the featured image, and the "About" would be the main content. If you need extra information, you can use custom fields (with a plugin to style them).


5

It's not a book but I wrote a "25 Steps to Understand WordPress and it's Terms" about a month ago in response to a question on the LinkedIn WordPress group and maybe copying it here will help? (Maybe I could every take these and turn them into a book for managers complete with screenshots; what do you think?) 25 Steps to Understanding WordPress and it's ...


5

I just ran into this situation. Here is a function I used to undo wpautop. I might be missing something, but this is a good start: function reverse_wpautop($s) { //remove any new lines already in there $s = str_replace("\n", "", $s); //remove all <p> $s = str_replace("<p>", "", $s); //replace <br /> with \n $s = ...


5

You can use output buffering to accomplish this. Add a high priority hook directly before the template is rendered: add_action('template_redirect', 'foo_buffer_go', 0); function foo_buffer_go(){ ob_start('foo_buffer_callback'); } Add a shutdown hook with an extremely low priority. add_action('shutdown', 'foo_buffer_stop', 1000); function ...


5

You already got something like this built in: Revisions. // Define the nr of saved revisions in your wp-config.php define( 'WP_POST_REVISIONS', 30 ); You can simply grab them by calling get_posts() with a post_type of revision. To show the difference between two revisions simply use wp_text_diff(). // Example $revisions = get_posts( array( ...


5

You could use a Git hook and post per XML-RPC to WordPress. A Git hook can be any executable file, even PHP. Another option – on GitHub – is to use the email hook: Go to https://github.com/username/projectname/admin/hooks, select Email and send an email to the blog. Enable the Post per email feature.


4

Add a meta box to the post editor, similar to the excerpt meta box, and get the content of the meta box in your sidebar. If you want to reuse the same text on different pages create a custom post type sidenotes and add a meta box with a select field to let the author choose the text.


4

In WordPress Dashboard > Settings > Media and fill the field "Full URL path to files" with your other domain. See the screenshot below: EDIT: I thought it would be obvious, but it isn't. Here's what you exactly need to do: You should map your domain to point to: public_html directory, IF it's also your WordPress installation's root directory. ...


4

There were several errors in your code. The biggest was that the function didn't even have a closing bracket, but we can probably assume that was just not copied into your post, otherwise nothing would have been working for you. This is a filter on the content right? It looks like you want to append these shares after your post content. If that's the case ...


4

If I read correctly, it's already a WP-multi site right? Maybe: create one main theme that will be used on all the sites create a child theme for each site that varies the color, or logo, or whatever to make it distinct. Use common widgets to pull in twitter feeds, etc. To increase the cross pollination of posts, use a special category that corresponds to ...


4

Also, from a purely PHP point of view, the function str_replace returns a new string, and should be assigned to a different string variable. The examples are like below. See the PHP manual. function content_magic($content) { $new_content = str_replace('<div id="content">','<div id="new_content">',$content); return $new_content; } ...


4

Theme demos, especially commercial ones, do not display out-of-the-box state of it. They are hand crafted and fine-tuned setups designed to sell (or at least convince for free ones). The official set of content that is typically used for quickly reviewing, evaluating and testing theme is called Theme Unit Test data. There are also unofficial sets, such as ...


3

The error message you get means that a function has been hooked without a valid callback. In other words it means that somewhere in your theme or in a plugin a function has been set but it's not "hooked" properly. See the example : function add_post_content() //<- the callback { // blabla } add_action( 'hook_name', 'wrong_name_function' );//<- ...


3

You are under a fundamentally wrong assumption: The content you input via the administrative back-end does not live in a file, but in the database, specifically in the wp_posts table. Do not be misguided by the table's name, a "page" is technically a post of type page. If you attempted to find the content you created via your "hosting file manager", it is ...


3

The alternative way. Problem with @david.binda solution is that: you have to hardcoding a lot of things, (manually write db credientials, table prefix..) You cannot use content filter (so if you have shortcode in your page, you will see some [something] instead of desired content..) sure you can load wordpress environment, but... Just yesterday I wrote ...


3

I have used qTranslate as well with success and seen it implemented in couple of blogs. but the problem with using any of the 2 plugins is that with the wordpress updates, you have to wait for the new releases of plugins versions then update. With other plugins, like a contact form, rating system or stuff like this , you can disable them temporary, find ...


3

Columns can be hidden from view using the screen options tab. On the upper right hand side of the dashboard click screen options Un check any of the columns you want to hide. Normally the edit options are displayed as horizontal text. A plugin or other function has changed this.


3

One way is to do this dynamically: function do_the_replacements($matches){ // $matches[0] = full string // $matches[1] = link attributes // $matches[2] = link contentes (the image) // change 'someclass' here... if(strpos($matches[2], 'someclass') !== false){ return ' <div class="featured-img"> <a ...


3

First off: The ID of a post or page is always an integer. "about" is either your about page's title, slug or both. Including the following in your "homepage's" page template or in the sidebar combined with conditional tag(s) will display the about page's content: <?php // query for the about page $your_query = new WP_Query( 'pagename=about' ); ...


3

One obvious, but probably not satisfactory, solution would be to disable the visual editor for these pages. To be able to really keep editors off sensitive markup, you should create a page template, like Cronco suggests. If you find that you have several editable parts, you can store them as custom fields. Unfortunately, editing these custom fields through ...



Only top voted, non community-wiki answers of a minimum length are eligible