Tag Info

Hot answers tagged

5

Take a look at your page source. The offending area is a section of content that's being output after the closing </html>. Judging from some of the links in that appended area, I'd say there a good chance you've been hacked, unless these look like yours: <div style="text-indent:-9999em"> <a rel="follow" ...


4

Try this (you may need to bootstrap WP by loading wp-load.php, depending on where you put this code). $args = array( 'post_type' => 'post', 'post_status' => 'publish', //'posts_per_page' => -1 //uncomment this to get all posts ); $query = new WP_Query($args); while ( $query->have_posts() ) : $query->the_post(); $f = ...


3

You have multiple options here, depending on the amount of flexibility you want to give the editor of the text blocks. Create a custom loop with WP_Query. See our examples and the Codex page for usage. Then you print the excerpts of the page these boxes are linked to. You can use attachments (images) and the full formatting here. Use widgets. See our ...


3

Simple answer: add_shortcode( 'hidemytext', '__return_false' ); But shortcodes should never be used like that. Imagine what happens when the plugin or theme with that shortcode is turned off: everyone can see the content now. This is not very user friendly. So switch the logic: show nothing or the bare shortcode tag by default, show the content only if ...


3

I’ve done something similar taking the simple approach of adding a CSS class to titles based on their character count. That CSS class then decreases letter-spacing and/or font-size. // Count the characters, taking Unicode into account $chars = mb_strlen($post->post_title); // For every 10 characters after the first 20, add a size $size = max(0, ...


2

For singular, one time pieces of content on the home page you might consider using widgets. Register a "sidebar" in your functions file and then call that sidebar into your home template. Drag text widgets into that sidebar and voila. For your feeds, use Posts or custom post types. Header and Footer really depend on what they'd contain.


2

My ten cents worth: if your page editor has admin access and can edit widgets, then you can create a widget zone for each of those items and provide an appropriate widget for each if your page editor doesn't have admin access, e.g. they have role editor or author, then they won't be able to edit the widgets to update them; use custom fields on the page. ...


2

To have a Network enabled shortcode, you only need a Must Use plugin. Just create the folder /wp-content/mu-plugins and drop your code there. From the Codex: Always-on, no need to enable via admin and users cannot disable by accident. Can be enabled simply by uploading file to the mu-plugins directory, without having to log-in. Loaded by PHP, in ...


2

There is a difference between the home page and the front page. Since the code uses is_front_page I assume that is what you want, but check the Codex for the difference. I don't know how your theme works, but it looks like the theme rolls several things into the "info bar". The code you posted just checks to see if there is any reason to display that bar. ...


1

While I rarely recommend plugins, the CKEditor plugin will do highlighting of selected text. That sounds like exactly what you want. And it is a greatly enhanced editor relative to the default one. Short of creating your own editor buttons and supporting functions, that would be a pretty good choice.


1

It's a PHP issue. The character ' is being escaped so that it can be safely in various places, not least of which is the database. That's why your ' look like \'. You can use PHP's stripslashes() function to clean it up, or (if it's an array you need to clean up) WordPress's stripslashes_deep() function.


1

In the insert_posts function, before the line $post_id = wp_insert_post( $post ); add the following (and suit to your needs): Link to Twitter User Page $post['post_content'] .= '<a href="http://twitter.com/__USERNAME__">' .'Follow me on Twitter' .'</a>'; and/or Link to Twitter Status $post['post_content'] .= '<a ...


1

If you are looking for a shortcode like this: [question text="What has four legs?" answer="Horse" message="Right answer!" messageid="message1" ] with output like this: then here is a very simple non-jQuery skeleton version: add_shortcode('question','question_func_wpse_88192'); function question_func_wpse_88192($atts, $content = null ){ extract( ...


1

I had to do a similar thing a few months ago on a WordPress build. The easiest way I found was to use a plugin called Spots. Description Content manage those little snippets of text that you need across your WordPress site and in widgets properly. Forget the text widget. Create a spot through the admin panel, add the content and then drop the 'Spot' ...


1

add this to functions.php add_action('init', 'remove_content_editor'); function remove_content_editor() { remove_post_type_support( 'posttype', 'editor' ); } Replace posttype with the name of the post type. It will remove the content editor from that post type's pages


1

Large »Custom Field« Textareas. Gladly those are easy to target. Wrapped up in a small plugin: <?php ! defined( 'ABSPATH' ) AND exit; /* Plugin Name: (#65922) »kaiser« Bigger custom field textarea */ function wpse65922_big_customfield_textarea() { ?> <style type="text/css"> #the-list textarea, #newmeta textarea { height: 200px; } ...


1

The excerpt is a specific field in WordPress and is wholly unrelated to custom fields, which is why the excerpt stuff you tried has no effect. There is no built in way to trim custom fields, you have to do it manually with a bit of php: $length = 20; $text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec diam enim, egestas ut facilisis sit ...



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