justinmaurerdotdev
Forum Replies Created
-
Forum: Hacks
In reply to: Trouble using get_pages with pre_get_posts hookAh okay. It’s good to know that my approach isn’t flawed. However, if that’s true, I’m a little confused by this portion of the Codex:
pre_get_posts cannot be used to alter the query for Page requests (page templates) because ‘is_page’, ‘is_singular’, ‘pagename’ and other properties (depending if pretty permalinks are used) are already set by the parse_query() method. See: Query Overview. The recommended way to alter the main query for page requests is to use new WP_Query in the page template itself.
Forum: Hacks
In reply to: Trouble using get_pages with pre_get_posts hookOkay, I’ve solved this. I just needed to replace
$query->query_vars['page_id']withget_queried_object_id()and everything works!However, I just read a response from a different site and it appears that indeed, according to the codex, pre_get_posts is not supposed to work with pages. Weird though, because it IS working. I guess we’ll see if anything breaks…
Forum: Hacks
In reply to: Custom fuction for dynamical links in wordpress menuI don’t think ‘url’ is part of the object that gets used here. According to the codex, wp_nav_menu_objects, returns an object “containing wp_nav_menu arguments”. Check the “$args” section on this page to see which arguments are available to you.
EDIT: After thinking about this a little more, I think this is a better approach:
You can use wp_nav_menu_items to add an item to the menu and format it however you want. It would look something like this:add_filter( 'wp_nav_menu_items', 'login_button_menu_item', 10, 2 ); function login_button_menu_item ( $items, $args ) { $user = wp_get_current_user(); if ( $args->theme_location == 'MENU THEME LOCATION') { $items .= '<li id="nav-login-button"><a href="/blah/'. $user->user_login. '/blah/">Profile</a>'; } return $items; }Forum: Themes and Templates
In reply to: the_post_thumbnail size not workingOkay, so I think I might have a clue to what’s going on here.
I added a function a while ago that removes the set height and width from the <img> tags. I’m thinking that WordPress might be “faking” the resizing of PNGs with the width and height settings. Does that sound likely?
Here’s the code I’m using to remove these attributes.
add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); function remove_width_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); return $html; }I’ll be able to get back with more info either tonight or tomorrow.
Forum: Themes and Templates
In reply to: the_post_thumbnail size not workingSure thing. Here ya go.
Forum: Themes and Templates
In reply to: the_post_thumbnail size not workingDoh! PNGs are working for you??
If I use a JPG as the featured image, it apparently works like a charm. Don’t know how I didn’t notice they were all PNGs before. Anyway, yeah. WordPress is not liking my PNGs…
Forum: Themes and Templates
In reply to: the_post_thumbnail size not workingI’ve been developing with Debug enabled and don’t have any errors. I just tried to manually set the size like so,
the_post_thumbnail( array(100,100));and it still doesn’t change the image. However, it DOES add a class to the image. Here are the results of this function:<img src="http://mywebsite.dev/wp-content/uploads/2011/05/image.png" class="attachment-100x100 wp-post-image" alt="image">DING DING DING! I just realized something important here. These images (I didn’t make them) are all pngs! Is WordPress incapable of creating thumbnails for pngs? Just looked in my uploads folder, and sure enough, the thumbnails exist for all of my jpegs, but no thumbnails for pngs.
Forum: Themes and Templates
In reply to: the_post_thumbnail size not workingHi Stephen, thanks for responding!
I’m building my own theme (started out with the Bones starter theme).
The query I’m using is for a custom post type. In the setup for this post type, I have
'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' ). Are there any features I’m missing from this list to be able to resize the thumbnails?Here is a link to the pastebin where I’ve pasted the loop I’m using.
Forum: Hacks
In reply to: How to force Tiny_MCE links to be relativeYou know what, the code I posted above actually DOES do what I was asking for. For some reason, when I posted this, I wasn’t seeing it working, but I am now.
Your thought about excerpts or links showing elsewhere is a tricky one, but on the site I’m building right now, links don’t show in the excerpts so no problem there. Ideally, there would be a way to force these links to be relative to the root, so this wouldn’t be an issue. Right now they show up as “../page/post” or whatever. But, they SHOULD show the full path to that post (or whatever content is desired) “/path/page/post”.
Forum: Plugins
In reply to: [Content Syndication Toolkit] Does this work for custom post types?Great. I really appreciate your help.
I need to run this purchase by my client, so don’t make any big changes on my account just yet, but this sounds like a pretty good solution to my problem.I’m going to mark this as resolved for now. Hopefully, you will see me again soon.
Forum: Plugins
In reply to: [Content Syndication Toolkit] Does this work for custom post types?Thanks for the reply.
Yes, it would be a combination of posts and a few post types.So, just so I’m clear, the Pro version DOES allow syndication of custom post types?
Forum: Plugins
In reply to: [CMB2] Help with custom show_onOops. I’ll mark it as resolved.
Forum: Plugins
In reply to: [CMB2] Help with custom show_onI think I’ve got this figured out. Thanks!
Forum: Plugins
In reply to: [CMB2] Disappearing Images in repeatable group fieldsHmm… I think I understand your explanation about why this is tricky. However, I don’t see how it applies to my situation. The two instances of the site don’t seem to be meaningfully different.
What would I be looking for if I were to attempt a manual fix here? Do you know of any migration scripts that would do this better?
EDIT: Scratch all of that. The entry appeared to be the same, but after scrolling deeper, I think a big chunk is missing. …and it’s fixed! Thanks for the info!
Forum: Plugins
In reply to: [CMB2] Disappearing Images in repeatable group fieldsWow. I just had this exact same problem. I came here to see if anyone had any ideas.
I just moved my site from test-site.dev on my laptop’s local apache setup to test-site.dev on my desktop’s local apache setup. The databases (including post IDs) are identical (besides the db name), but for some reason, the repeatable group entries that I have are not showing up. I can see them in the database (like @clampdesign), but I really don’t want to have to re-enter all of these fields. I have 15-20 Title/Description pairs attached to one page.
I don’t have a live version of the site yet, so I won’t be able to show you what I’m talking about, but these entries are not showing up on the front-end or the page edit screen. The custom fields DO show up (as empty fields), just not the filled-out entries that should be there. Any ideas how to get WP to recognize them?
Should I create a new thread?
Thanks in advance for any help.
EDIT: Two notes.
1) In the process of moving the database. I’m fairly certain this has nothing to do with this problem, but just throwing it out there.
2) My version of the issue has nothing to do with file URLs, but seems to be the exact same problem as @clampdesign’s.