« first day (626 days earlier)      last day (4617 days later) » 

01:21
Anyone know how to remove a screen option from a custom post type table column?
1
Q: How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?

Michael EcklundOn the page where we list all posts made: example.domain.com/wp-admin/edit.php There is a Screen Options tab in the upper right corner. Upon clicking this, a menu slides down. Contained within this slide down menu, are check boxes. When checking or unchecking these check boxes, certain columns i...

@MichaelEcklund .... MikeSchinkels already answered that?
@StephenHarris he covered generic pages and posts, but not custom post types.
@MichaelEcklund They're the same, just slightly different hook names.
yes i know but it doesnt work.
@StephenHarris How would I go about removing let's say, "wpseo-score" from the post type of let's say, "business"?
@MichaelEcklund wpseo-score being a column?
01:28
yes
i know i would need to change the action hook to something like: manage_business_posts_custom_column
Use the filter manage_edit-business_columns to remove the name of the column (presumably, 'wpseo-score') from the array. Similar to Mike's answer.
@StephenHarris thanks it worked. could you explain to me what Mike's comment about the second param not being passed means?
@StephenHarris what is the second param used for?
Or the filter manage_business_posts_columns would do it too. I think maybe this one is preferable.
@StephenHarris codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_c‌​ustom_column "For built-in post types and multiple custom types, use manage_posts_custom_column. "
@MichaelEcklund I'll just get the source up.
01:34
okay thanks
@MichaelEcklund There are two hooks you can use to remove columns: manage_edit-${post_type}_columns or manage_${post_type}_posts_columns
@StephenHarris I think if you could just add another answer to expand off Mike's answer for people that may be looking for a custom post type example as well.
it would be rather beneficial to the community.
Anyone here knows how to add a filter only if the user is doing a specific action (or is on a specific admin page ?)
@StephenHarris I can assure you, that I am not the only one in this community questioning about custom post types.
@MichaelEcklund So the manage_posts_columns hook is fired for all post types except pages. The second parameter is there to so that you can only do something for certain post type(s). There's probably some backward compatibility going on there
@krembo99 load-{$page_hook} or admin_action_{$action} are probably what you're after. Ask it as a question - it's a good one. I'll answer it properly tomorrow if no one else has. I'm off now.
01:42
@MichaelEcklund - Ok.. tnx.
 
1 hour later…
02:54
Mods on SO are very quick on deleting comments. I had a conversation with a mod yesterday about improving my question, and the next minute the conversation was over, there were no comments (there were only 3).
@AahanKrish As far as I know, they don't want chitter chatter. Just questions and answers.
@MichaelEcklund yeah... I don't have rights to delete "obsolete" comments (on WPSE), and my last couple of flags were declined :S
(it's probably the mods sending me a message, "GET A LIFE!")
 
4 hours later…
07:12
Morning everyone
que passa, you're up early...
07:42
go live process had me out of bed earlier than usual
Too bad PHP doesn’t have many really large projects built on it to prove it can scale. #ohwait
muhahaha
@AahanKrish I have a second solution to your footer issue
html { min-height:100%; background:#225E9B; }
if the content cant fill the height of the browser, the body will give the content a white bg, but the html element will be the full page height, so it gets the blue footer colour, so there's no big white band at the bottom
08:07
github.com/zamoose/themehookalliance interesting if it gets anywhere... Hybrid already does something like this so would be trivial to add support for
08:38
@Rarst Its like OGL boilerplate but more verbose
glBegin();
go stuff
glEnd();
Original Gangster boilerplate? for real..
09:20
hmm is there an article anywhere that explains the mechanism behind bbpress and buddypresses template defaults thing?
@Rarst Great. That's exactly what my "framework" does since ages. Incl. auto hooking of template parts...
But without such a mess.
@TomJNowell @kaiser plenty of framework do thing like that, the point of THA is to genericise it
@kaiser markup there is just example/concept implementation, obviously every theme will have its own
@Rarst In my case everything is generic/context specific and alligned to template part naminging.
@TomJNowell Isn't this very overwhelming vs this one? Also, see how Google does it. Probably, strip/band-like footer isn't such an awful thing after all?
@TomJNowell Oh :P I think I understand what you meant. My content is already long enough, and if someone has a larger screen, the little space that's left will be filled with the footer color. Isn't that the thinking?
@AahanKrish yes that is correct, you may also want a minimum height on the main content area too
say 400-600px
the content area should always be bigger than the footer and header on that site
09:33
@TomJNowell But I've already made sure that no page on the site is small now -- take a look: whatthenerd.com/contact-us
You got me :D
@TomJNowell 400px will look better on smaller screens
@AahanKrish you can, and should build things so that theyre flexible to handle these things
@AahanKrish try 60% of the screen height
also try the resolutiontest chrome extension
brb
I already have it
ok
09:55
@TomJNowell Some thinking to do for larger screens (h-1440, h-1600). Strip-footer looks better on larger screens.
I will take care of it... :)
@AahanKrish I disagree, make the content block taller with a min height
for reference my screen is 1080p
@TomJNowell mine too. Try the search pages for instance.. with a min-height of 600px they start to look bad.
So, I'd have to go with 400px. Okay, not a problem. But how about screen sizes h-1440 and h-1600? (h = vertical resolution)?
the blue background is very dominant
@TomJNowell By the way, do you hate this? i.imgur.com/wmV2B.png
10:10
I would add more to your 404/nothing found page
like recent posts, or suggestions
helpful suggestions
profitable suggestions.....
same with search, you could add a 'you searched for X' kind of things, Y many where found
@kaiser in my case it's Hybrid's atomic hooks :)
@TomJNowell right.... better idea (I was clumsy enough to avoid that thought)
@TomJNowell Forget about it. I'll deal with it. Which of these two solutions do you think is better? wordpress.stackexchange.com/q/52662/10691
@Rarst Like carrington nano template stuff?
@kaiser hadn't used carrington
10:29
@kaiser nano templates?
@AahanKrish mine
the one where you don't have a lead image as the first image in your post
where it's a simple has_post_thumbnail or something
and no regex/jquery/dom objects involved
its faster
more flexible, and it's easier to maintain
@TomJNowell Something I read in source years ago. maybe they're naming it otherwise
@TomJNowell True... I decided not to use it for a reason. Anyway, now that I don't remember it, I looking at how I can set mutiple featured images for posts
(or will you say NO! to that too?)
@StephenHarris Lend me a helping hand?
@kaiser I can try :)
@StephenHarris :)
\wp-admin\includes\plugin-install.php - LINE 42
apply_filters('plugins_api', false, $action, $args);
↑ This one always returns FALSE for has_filter().
I attached a cb to the filter inside a classes __construct() ( - which gets hooked on init). Which hook should I use else to make this one work? Can't get behind what filter/hook gets fired.
I already looked at other examples and all of them seem to simply hook on init...
@StephenHarris Nvm. Found the error: if ( 'plugins.php' !== $GLOBALS['pagenow'] ) return;
Locking myself out ... again :P
10:43
@kaiser yup, init works for me :)
@StephenHarris Now the only thing I'm wondering is if I could use any check to avoid loading this on every screen ... ?
@AahanKrish no, because I originally suggested it to you, twice
@kaiser depends when you need to filter it? Every time plugins_api is called?
@TomJNowell lol! No for what? multiple featured images? (In that case I know your reason :) )
@StephenHarris I'm trying to update from a github repo...
10:47
@AahanKrish no no no I say YESSS to multiple featured images
but I would say an even bigger YES to just using the featured image anyway
@kaiser how will plugins_api help? That will check the wp repo?
@StephenHarris No. The ↑ above filter gets saved into a var $res and the update from repo will only happen if $res is FALSE, so I'm basically overriding.
@TomJNowell Hmm... okay. I'll go with 1 featured image now, 'coz I can always switch to multiple featured images if I ever need it! :D For now I will let that question run, lets see what solutions people cook up
@kaiser ok, I get you now. Set it to false then use plugins_api_result
right
10:54
mmm... well plugins_api could be called anywhere. So I would just hook onto on init and not worry about the overhead - its going to be minimal right?
@StephenHarris Depending. I'm using the default 12h (when not in DEV mode) for the transient, but I'd like to avoid any overhead in any case.
@kaiser well plugin-install.php calls it. as does update-core.php
But I've never looked into the details of how WordPress checks for updates. It does so with transients/cron? Presumably plugins_api could be triggered by this on any screen?
@StephenHarris Right: Transient. And I guess, it could be triggered on any screen.
@StephenHarris if ( ! in_array( $GLOBALS['pagenow'], array( 'plugins.php', 'plugin-install.php' ) ) ) ... work fine. Thanks!
11:11
@kaiser even when triggered by the transient?
@StephenHarris Transient is set to reset after 0, so yes so far. Currently testing.
Somewhere in my script, everything starts failing when the folder name contains an empty space. Don't get behind what exactly is wrong, but in core functions.php somewhere it starts asking for the file/foldername without spaces and fopen() fails hardly...
 
2 hours later…
12:51
<-- close to exploding at the moment...
@kaiser are you a ticking time bomb?
@Brady Yes, but got a bug: timer resets constantly ;)
@kaiser google have a fix for that, leap seconds, srs bsns
@TomJNowell Believe me: It's I better I crash than explode :P
13:22
@Rarst That's premature optimization for me though...
8D
shocked... truly shocked... does something me and @TomJNowell say really sinks in?
@Rarst shhhh, I dont want to jinx it
anu
anu
Surely functions shouldn't be deprecated unless there's a replacement available?
anu
anu
13:42
So, is accepted practise to continue using the deprecated function, or write something that essentially duplicates it to avoid the dep notice?
@anu There's the direct query example - which imho should be the solution. It works.
anu
anu
@kaiser yup, that's what i was going to do, it just seems weird, as the query is basically the same as the one in get_blog_list (the where clauses probably should be added to the direct query anyway)
@anu I don't remember what it was, but I ran into another example of "deprecation without replacement" some weeks ago. Seems like core devs got their own plans for all of us. The replacement propably is wp_remote_get( 'nacins_brain', array( 'sslverify' => true ) );...
anu
anu
@kaiser lol
is there a general purpose $wpdb facility to only return part of a result set - ie a general purpose equivalent to "posts_per_page" for the post query object
@anu POSTS_CLAUSES :)
the filter
1
Q: How-to exclude terms from the main query the most performant way?

kaiserThis Q is a follow up to this answer on the Q: "How to exclude a specific term for the search?". 4 ways to filter out posts that have a specific term Type | Pro | Contra -------------------------------------------------------- Run a new query | Easy to imple...

Just the system - not the task
anu
anu
13:56
@kaiser does that just works on wp_query though? would a call to $wpdb->get_results use that filter too?
@anu I guess, but not shure. Normally every $wpdb query should result in all those filters.
Give it a try
anu
anu
cool - i'll check it out
When you thought it was dead.... query_posts!
0
A: show posts only on homepage but using custom post type and taxonomy for query posts via url

Stephen HarrisThis is because query_posts replaces the original query with a new one (which includes all the listed post types). For other reasons, you should not use query_posts! For your purposes you can use the pre_get_post hook. This is fired before the database is queried for posts. The 'main query' is...

14:21
it should be renamed to something else like adjust_query
Anyone know where I can hook into to see if single post of a CPT? I can use a template file single-{CPT}.php but I need a hook thats earlier to issue a redirect or a 404
pre_get_posts is too early as I need to know the post ID
@Brady Can you use conditional tags such as is_singular and is_single together?
then issue your redirect...
@userabuser still need to know the post ID
pre_get_posts is what it says. it runs before its got data from the db
At that point it doesnt know the ID
so you want to know if a post belongs to a CPT?
that's what is_singular is for...
no ID required...
@userabuser your missing what I'm after
14:32
@Brady template_redirect?
or template_include
...depending on what you actually want to do....
I can hook init and do what I want there but is that the right place? Can I run earlier?
hrrrm...
I have a CPT that has custom meta that will redirect to somewhere else
"see if single post of a CPT" <-- what does that mean then?
@Brady I would go for template_redirect if you're redirecting somewhere else...
14:34
Ok, do you need to know the ID of the post up front?
I can use single-cpt.php and do the redirect there but the problem is that WP has fully loaded with the template engine to do a redirect. Plus I have wasted one PHP file
@StephenHarris will try that
@Brady single-cpt is no different than is_singular with the exception that you don't need to create a template file to handle your redirect.
if(is_singular('cpt_here')) { template_redirect bla bla }
@userabuser Go back to sleep ;)
@userabuser Im looking for a hook not a conditional function...
@Brady Why is pre_get_posts too early? If it's for a singular post you'll have the ID/slug already...?
@StephenHarris slug yes ID no
14:40
@Brady from which you can get the ID? Alternatively, template_redirect is fired before the template is chosen but after the db has been queried
@Brady If you can do what you want in init, then you can do it in pre_get_posts
@Mods... this conversation is totally useless. the OP won't test my answer. Clearly the comments are obsolete. Please delete them?
@AahanKrish No its not, the conversation alludes to the fact that your answer may in fact also work, which may be helpful for someone else, even if the OP doesn't want to test or select your answer. I say leave it in place.
@AahanKrish to be fair the other answer was simpler, your final comment could be taken as hostile, and I agree his response about the programmer mentality was not a nice response
I say make no change
Guys, I am NOT talking about the answer. I am talking about the COMMENTS.
@TomJNowell Actually, I did try the other method even before he posted the answer. It breaks text / image in the post, unless the OP uses a number of clear:both. I wanted to see if there's a better solution, and thought using span instead of div was simply better
@AahanKrish then say so and point it out =p
14:54
@TomJNowell He'll see it for himself to night.
When you ask a question, you are supposed to be ready to check all answers, be nice to the answerer, and stuff. I didn't like the way he dealt with it.
@AahanKrish seems like it would depend on the theme and the theme styling
@TomJNowell maybe. I just made a quick try.
@AahanKrish I am talking about the COMMENTS, not the ANSWER.
anu
anu
the guy isn't being rude or hostile at all - chill @AahanKrish.
@anu when did I say that?
14:58
its Toscho's fault anyway
@userabuser what did he do?
anu
anu
@AahanKrish you didn't, but you're getting way too excited about something trivial.
@AahanKrish nothing, just trying to defuse the situation with nonsense...
@anu The only thing I "didn't like" is he didn't even want to test my answer. And why should he test my answer?— because even though the other answer may seem trivial, and simple, some other answer may actually work better. Hmm... maybe I did get much too excited. ;)
@AahanKrish the other answer didnt get tested either =p
I recommend cutting your losses
15:03
"Why" doesn't constitute "must". He might very well be lazy. Also, as you can see Tom pointed out a potential flaw for which could mean he needs to test your answer anyway.
anu
anu
He's under no obligation to test your answer, especially if there'a an answer he prefers.
and he's wasted his own time by not testing anyway
also he's in chat watching
Yeah right... and after a day or 2 he comes back to tell me my answer didn't work... and I am supposed to re-read all the stuff I did now, to answer the question, to correct my answer. We need to make things easier, not tougher.
@AahanKrish Are you proposing a mandatory time limit for which people should test answers?
@userabuser No.
@TomJNowell lol! he's not!
15:06
Tom == Mike, its all a big trick.
Okay, I'll drop this conversation here. This is the effect of not eating anything since morning :S
@AahanKrish psych
@AahanKrish If you simplified your answer to the CSS (inline-block) then also added another CSS declaration for images with the fancybox class, all his images would align nicely and would suffice as being a super easy solution
15:25
@userabuser divs have issues with inline-block
that's the inherent reason why I had to use the filter function
float:left then, remove the clear both... ensure rogue <p> tags that stand on their own are also cleared and its solved.
@userabuser Look at the page he linked in the question. If he does as you say, he'd have to use something like <div style="clear:both;"></div> instead :)
Your solution is one more complexity, which is suitable for this site, it appears though as if he wants an easy-peasy solution which is CSS based in nature which should be asked at SO because it has little to do with us. I'd personally go with your answer, at least test it.
floating doesn't seem to fit his case. Not unless he's ready edit the post wrt to the css
@AahanKrish I already did, I even ran the tests and it works fine for me...
Then he's dreaming for a quick fix if he doesn't want to
15:29
Oh, I'll check again...
0
Q: Custom plugin, Custom Post types, and Theme question

willbeelerMost of you are familiar with Custom Post types. My custom plugin is utilizing them, and I want to theme my own "single-my_custom_cpt.php" file. However, I want to store it in my plugin folder, and allow that it be over-written in the websites' active theme folder. For example, single-my_custom...

All three suggested duplicates are not duplicates. What is going on here? :)
Oh you didn't hear? He's drunk...
@userabuser Did you scroll down? The it's breaks down the page. Besides if it's css the question should be closed or moved :D
What I didn;t tell you is that I actually flagged the question before answering. :)
15:37
@userabuser It is related but really not a duplicate.
@toscho there how to use a template from a plug-in rather than theme though?
@toscho feel free to copy and paste and change taxonomy template to the single template... :)
No it is more specific. I think he is asking for something like this.
@AahanKrish The only thing it breaks are those images that are not styled with the .wp-caption element. For which you'd need to then add another declaration for the <img> files held within the a.href class of fancybox (more css). But if you want to be technical you'll notice he only references wanting to make his images two columns for those which have captions. For which the above would work fine. If that does not suffice then he needs to add more CSS and yes... not a WPSE issue.
I’ll write an answer … and rewrite the question.
@AahanKrish ...unless he wants to test your answer, its border-line flagable as being too localized an issue.
15:40
@userabuser so, what do we do? flag?
@userabuser Clearly, he doesn't even think mine is an answer. So, what he's expecting is clearly off-topic IMO
nevermind. We can't be sure about that either. :P
If that is the case, being that he doesn't feel the need to tackle this from a WP perspective, it needs to be shifted to SO. If you flag it, I would update the answer (don't remove anything) but just quickly add the reference to floating his wp-captions and removing the clear:both declaration. If he comes back and says I don't want that for all pages, then you can provide an extended WP function to add a unique body class to specific/page/id/CPT that will allow selective styling.
Failing that, then he is in the wrong place!
Its a shame though, because I'm giving you an upvote for effort in thinking about how to tackle this with regexp (from a WP angle)...
@toscho So locate a custom template in the theme?
@userabuser Update my answer? Feel free. As for flagging the question, I am not really sure :S
As in....
2
A: Load different template file when condition met?

Stephen HarrisCan you perform the logic on the template_include filter? Else, you could set a global/constant and use that in template_include to serve up the appropriate template. The template_include filter filers the path to the template file to be included. To avoid errors you should check if the template...

@AahanKrish I might, I might not. Time is of the essence. Play the question by ear and see where it goes... if it heads south, then you'll know what to do.
15:50
@userabuser flagging it as "needs mod attention" with details "too localized, vague, off-topic" — vague because he doesn't tell us how exactly he wants us to tackle the issue
@userabuser Flagged! Go ahead!
@StephenHarris That’s not the same as a fallback.
@toscho yeah is - condition is that it doesn't exist in the theme folder...
For which you use template_include since this passes the template
@StephenHarris That’s … a rather free interpretation. :)
Jeff Atwood on November 15, 2010

As Stack Overflow grows — or any other Q&A site in the Stack Exchange network, really — there’s a natural pressure to discover and link duplicate questions. The more questions you have, the higher the possibility a given new question isn’t in fact a new question, but a duplicate of an older existing question. Because of this, we’ve continually enhanced the tools for finding, linking, and merging duplicate questions:

Handling Duplicate Questions Linking Duplicate Questions Improved Question Merging …

@toscho So it was exactly what I have here :)
1
Q: Custom Taxonomy in plugin and template

brenjtI have a plugin that I am developing that is using custom post types and taxonomies. My question is this. How can I load the content/theme data from my plugin on to the page when the go to the custom url of the taxonomy? EDIT I am trying to use the plugin's template files and not the themes for...

@toscho can't hurt though right :). But why do you use template_redirect and not template_include?
@StephenHarris Hm … doesn’t mater much, does it?
16:01
@toscho well a third party plugin can't do much if you redirect. template_include allows the template file to be filtered.
@StephenHarris This question is not asking for a fallback, it wants to enforce a special template.
@toscho that's true... gave that for free I guess :)
But if I hook into 'template_redirect' a third party plugin can still hook into 'template_include' and change my choice.
No, wait, that’s wrong
sigh changed my answer. Thanks Stephen. :)
16:46
@toscho no worries :)
17:04
@StephenHarris @toscho @Rarst @userabuser @anu @Brady @TomjNowell @Bainternet @ChipBennet Honestly: We should all be much more generous with our upvotes. We now got a strong "core" user base (mostly you, that I mentioned) and we could without a problem get answer votes equal to those on SO if we would just upvote others answers (as long as they're ok). Said. Thanks for reading.
@kaiser We need more 3k users. Don’t forget that.
@toscho I'm not. currently editing.
@toscho edit done
@kaiser Fair point, I don't upvote anywhere near enough, more so out not remembering to do so more than anything else, so good idea!
17:35
really good answer
0
Q: Schedule event every second thursday of the month

Josh AllenI'm working on an email system and they want it automated to send out emails every second thursday of the month. I've got the PHP sorted out and ready to fire a callback to send the emails, but I'm a complete newbie when it comes to cron and scheduling events. Essentially, I have this: echo da...

... maybe...
edited and upvoted
Same goes for the question - if it brings up an answer worth upvoting, the question itself imo is good enough for upvoting too.
 
1 hour later…
19:06
public facing docs (for WP code, on WP) - must have plugins and stuff? #lazyweb
19:47
A fun question :)
0
A: Filter post listing by meta value which is a date

Stephen HarrisAdd a query variable to store the month So first of all it'll be necessary to create a custom query variable - this will store the month we're after (in 2012/6) format. I'll call it custom_month, but its best practise to prefix it to avoid clashes with other plug-ins: add_filter('query_vars', '...

What happened to the share on twitter/facebook buttons after you posted an answer...?
@Rarst some more publicity for you ;)
@StephenHarris someone scrubbed sharing stuff from eveywhere... and SE was pretty much the only sites where I did use them
@Brady getting famous 0.5% complete
@TomJNowell don't bother, CWs are discouraged nowadays
ooooo
good to know
 
2 hours later…
user30
22:27
28
Q: Stack Exchange Blogs Down

Kyle BrandtSome of our wordpress instances were exploited yesterday at 11 AM UTC. We noticed that the compromise had taken place today and took the blogs offline as soon as we noticed. We have since restored the wordpress files from backup* to a new set of servers. Using our logs we were able to identify th...

user30
ouch, timthumb vulnerability
@ThomasMcDonald one day when I am out of job and starving I will haunt SE into hiring me to run blog stuff... :) as far as I know they still don't really have any dedicated WP people on it
@ThomasMcDonald Really, get some decent theme developer. :P
user30
22:42
I wonder if it's something left behind from when I ran the blogs.
user30
hope not.
user30
@Rarst I don't think they make Stack Exchange very much money/pageviews.
user30
Aside from when the SU blog was top on HN and /.
@ThomasMcDonald that is why "out of job and starving", not "right now so they can pay me ton of moneyz" :)
user30
yup
22:47
on other hand I am dirt cheap so it might not even get to "starving" stage for them to afford me... :)

« first day (626 days earlier)      last day (4617 days later) »