155 reputation
110
bio website
location
age
visits member for 2 years, 11 months
seen Aug 6 at 15:48

Dec
22
comment How to add custom post types to normal category pages
I think it must have been a caching issue (I use W3TC). I added the $query->is_main_query() check back and cleared the caches of W3TC and it still working fine. I don't have anything special in category.php, its just the loop.
Dec
22
comment How to add custom post types to normal category pages
Not really, at least not that I know of unless some plugin is doing it. All I have is the usual loop. But it IS working now. Unless the problem was being caused by some weird caching issue and I thought that this change solved it... I could try putting in the is_main_query() check again and see.
Dec
22
comment How to add custom post types to normal category pages
It seems to be working fine so far. What should I look out for?
Dec
22
comment How to add custom post types to normal category pages
For the is_category() I was referring to this codex.wordpress.org/Function_Reference/is_category. Its not a method of the $query.
Dec
22
comment How to add custom post types to normal category pages
@PieterGoosen The problem was that in both my original method and in yours we are both using is_main_query(). For some reason when I removed that, the custom posts appeared as I wanted. The nav_menu_item is required however when the is_main_query() is removed, because otherwise menus stop working.
Dec
22
comment How to add custom post types to normal category pages
The problem is not related to register_taxonomy. As I mentioned above, the checkboxes for the categories already display fine in the admin screen when editing the custom post type.
Oct
30
comment How to set up plugin project with XDebug remote debugging in PhpStorm
LOL, PHPStorm is an awesome IDE though and in the latest version they added support for Wordpress development of plugins. I use it too (syntax highlighting and code completion does give you a warm fuzzy feeling inside that notepad doesn't) but I didn't get PHPStorm to recognize wordpress functions and auto-complete them so not sure what the advantage of setting the project as 'Wordpress Plugin' are. I don't debug using IDEs so not sure what the OPs problem is, but I would also leave it here, it might prove useful to others too if someone answers.
May
21
comment Limiting allowed html elements/strip harmful scripts from editor
This doesn't apply for the latest wordpress versions because TinyMCE changed. For instance, the block formats needs to be like this instead now: $initArray['block_formats'] = 'Paragraph=p; Address=address; Heading 1=h1; Heading 2=h2';
Mar
13
comment Disable wordpress widget automatically on error
Not sure what you mean. I have no difficulty with my code, its whether it is possible to tell wordpress 'don't show this widget completely' what I am asking. By don't show I mean not even the title or the background box or anything. Of course I can have an If statement or a try - catch to handle the exception, its hiding the widget altogether if it happens I am asking about. Maybe there is a flag in WP_Widget or some way. I don't know what I should give you because its just my code which is irrelevant for what I am asking. Just assume I have an error code from my function call...
Feb
2
comment Getting parent category hierarchy as objects from category template
Thanks. What I did instead is that I used the parent property of the current category. If I call get_category($current_category->parent) recursively until I find one which has parent = 0, I suppose I will get all the hierarchy. Seems to be working unless there is a catch somewhere.
Sep
30
comment Wordpress REST endpoint with JSON for Mobile App integration
Thanks for your insight. Yes a system which just uses the self hosted site is much better in all cases.
Sep
15
comment Varying the number of posts per page from the first one
@s_ha_dum Thanks for the pointer. I managed to fix it by setting the offset parameter, which I guess I have to calculate according to the page I am in. Answer below, from some initial tests seems to work.
Jun
5
comment Custom blog settings
Nice example thanks for that. Will select your answer instead of mine. Thanks for sharing.
Jun
5
comment Custom blog settings
Wow thanks for that
Apr
22
comment Wordpress REST endpoint with JSON for Mobile App integration
Thanks for the pointer. Maybe it could be authenticated in some way to avoid direct scraping? Although as you are saying its not seriously protecting against anything. (Search engines scrape anyway to index your blog).
Mar
1
comment Wordpress REST endpoint with JSON for Mobile App integration
I don't know if I am incorrect, but both seem to be targeted for posting/managing blog posts rather than plain retrieving information. Am I missing something? For instance, in the XML-RPC version simple operations like wp.getPost() require a username/password. I just want to develop a small app which displays pretty much the same articles on the blog, but formatted properly for it.
Jan
8
comment Removing the […] from the excerpt returned by get_the_excerpt() only in some places
Yes thats understood. So one would need to get the excerpt, and if its empty use the content and truncate it to the maximum.
Jan
2
comment Removing the […] from the excerpt returned by get_the_excerpt() only in some places
I have no problem with caveat 2 because I built the theme myself. I do have a problem with caveat 1 however, because my bloggers often don't put the 'more' separator in their post, which is often the case when the [...] appears. Maybe I can use the post's content in some way and simulate what get_the_excerpt() is doing, i.e. if $post->post_excerpt is an empty string I use the full content and truncate it myself to the maximum excerpt length? Where can I find all the attributes of the $post variable? And how can I get the maximum excerpt length parameter from wordpress with PHP?
Dec
30
comment Removing the […] from the excerpt returned by get_the_excerpt() only in some places
Yes, but that will also effect the main posts that get listed on the main index page, where I do want the more string to appear.
Oct
21
comment Allowing post attachments without allowing to insert in text
In order to disable "Insert into post" look at my other question here: wordpress.stackexchange.com/questions/69776/…