Chris Huff
Forum Replies Created
-
Forum: Hacks
In reply to: Can you move the default position of the Featured Image meta box up?You’re right, that should have been ‘side’.
Regarding the proper padding on the right side, I saw the same thing as I was fiddling with the code. But then it corrected itself once I had the code right. So I’m wondering if it will straighten itself out once we get the code right.
Could it be that your theme or a plugin has already tweaked the Featured Image meta box? I wonder if it also changed the id for the meta box, which is why my code would not remove it.
View the source code of your edit post screen and find the id for the Featured Image meta box. My code adds one with the id of ‘postimagediv_new’ so you’ll want to find the id of the other Featured Image meta box. If it’s not ‘postimagediv’ (the default id), you’ll just have to remove it like I had you remove the default one.
Forum: Hacks
In reply to: Can you move the default position of the Featured Image meta box up?By the way, if you want it below the submit box, you’ll just do the same to the submit box. You can play around with the order in which you add them back, so that it will come out in the order than you want them. Let me know if you need more help with that.
Forum: Hacks
In reply to: Can you move the default position of the Featured Image meta box up?It’s definitely doable. Basically, you will remove the meta box for the featured image and add it back in to be at the top.
function remove_metaboxes(){ remove_meta_box('postimagediv', 'post', 'normal'); } add_action( 'admin_menu', 'remove_metaboxes' ); function add_metaboxes(){ add_meta_box('postimagediv_new', __('Featured Image'), 'post_thumbnail_meta_box', 'post', 'side', 'high'); } add_action( 'add_meta_boxes', 'add_metaboxes' );And actually, I think it will even work without the remove function, but it just makes more sense to me to remove it first so that the id doesn’t get confused with the old one.
Forum: Hacks
In reply to: Where to find the php code to change specific contents of a page ?It could be one of several things, depending on how your theme is coded. Look in your theme’s index.php file to see how the content is being called for (should be using some variation of either the_content or the_excerpt). Please post that line of code here.
Most likely, from what you describe, your theme is truncating the actual content of your post. One solution would be to add the <!–more–> tag to each post to tell WordPress where you would like to cut off the text on the homepage by clicking the icon for “Insert Read More tag” when editing a post.
Forum: Hacks
In reply to: How to determine the number of entries in a fieldMaybe something like this?
<?php if(get_field('prevention')){ $prevention_array = array(); while(has_sub_field('prevention')){ $prevention_array[] = the_sub_field('prevention_method'); } $i = count($prevention_array); if($i==1){ the_sub_field('prevention_method'); } else{ echo '<ul>'; foreach ($prevention_array as $prevention_method) { echo '<li>' . $prevention_method . '</li>'; } echo '</ul>'; } } ?>I haven’t tested this, since I don’t have fields and subfields labelled ‘prevention’ and ‘prevention_method’ but it should work, I think.
Yes, I get that you want to tweak the css. What have tried? Because from what you described in your first post, I’m not sure why you weren’t able to achieve what you wanted. But if you can be more specific, posting code that you tried, maybe we can determine what you’re doing wrong.
Please be more specific about what you tried to do in the style.css, and what didn’t work. Post code that you tried, if possible. This will give us a better idea of what you’re trying to accomplish.
Forum: Hacks
In reply to: Website size optimization for mobile devicesTry putting this in the <head> section of your theme’s header.php file:
<meta name="viewport" content="width=device-width">Forum: Hacks
In reply to: Changing tagNot sure why that’s not working for you. I just tested it and it worked just the way you wanted for me. In fact, it actually output exactly the same this:
<title><?php wp_title('|', true, 'right'); ?></title>Which was what my theme had before I tested yours. But if that’s not working for you, either, try this:
<title><?php if (is_home () ) {bloginfo('name'); } else { wp_title( '|', true, 'right'); bloginfo('name');} ?></title>Forum: Plugins
In reply to: Change this plugin so that the image is inserted into the first paragraphWhy not just add your image into the post as usual? While editing a post, click “Add Media” then select or upload your image, then click “Insert into post.”
Forum: Plugins
In reply to: Change this plugin so that the image is inserted into the first paragraphI’m a little confused. So you don’t want to show the featured image at the top of the post, but you do want to show the featured image in the post, at the top? How is this any different?
Forum: Hacks
In reply to: making links no-follow except once…..Try this. Edit the NoFollow Links plugin, and find this line near the bottom of the code:
if (is_array($links)) {And replace it with this line:
if (is_array($links) && !is_front_page()) {This (I think) will do a quick check to make sure it’s not the front page, and will only make the links nofollow if it’s not. Let me know if it works or not.
Forum: Hacks
In reply to: Don't trim space at the endThat did the trick! Thanks so much!
Forum: Hacks
In reply to: Don't trim space at the endI tried to modify it like this, but the result is that it only retains the spaces for the last input field:
<script type='text/javascript'> function fix_input() { var x = document.getElementsByClassName('text_input'), i = x.length; while(i--) { x[i].value = x[i].value.replace(/ /g, ' '); return true; } } </script>I’m guessing it has something to do with “return true,” but I just don’t know what to replace it with.
Forum: Hacks
In reply to: Don't trim space at the endDionDesigns, that works great! Thanks!
Is there a way to modify this to apply to all of the text input fields in a form? Or, even better, to all of the input fields with a certain class?