How to create a custom sort for WordPress categories

If you’re already using Advanced Custom Fields (which you should be!) you can create an order field for your categories from which you can set them manually in numerical order. Then all you have to do is: $categories = get_categories( $args ); usort($categories, function($a, $b) { return get_field(“category_order”, “category_”.$a->term_id) – get_field(“category_order”, “category_”.$b->term_id); }); foreach ($categories … Read more

WP 3.9 TinyMCE no longer loads on category description editor

I was having the same issue and the problem was actually coming from the way the js was dynamically generating tinyMCE. Prior to v.4, it was: tinymce.EditorManager.execCommand(‘mceAddControl’, true, id); With 4, you need to use: tinymce.EditorManager.execCommand(‘mceAddEditor’, true, id); Have a look at wherever your function ‘wp_tiny_mce’ is – might be in there.

Using wp_category_checklist in a widget

The problem is that to make the update method of widget class work, the name inputs on the form method should be set via $this->get_get_field_name(‘name_of_the_field’); but wp_category_checklist has no argument to setup the name of the inputs (checkboxes). However, wp_category_checklist uses a walker class to print the checkboxes and allow customizing it. By default the … Read more

How to remove the term “category” from category pagination?

Why does the problem in pagination happens? Say you have a category named wiki. Now, when you have a category URL like: https://example.com/wiki (instead of https://example.com/category/wiki) and say page or post URL like: https://example.com/a-page or https://example.com/category-slug/a-post WordPress has really no way of knowing if https://example.com/wiki/page/2 is a the second page of another page / post, … Read more

How to get permalinks with category base working with sub-categories

I was able to get this to work pretty easily actually. I am now able to have my category base in my permalinks. This allows me to now have URLs like: http://www.new1450.dev/industries/ {Main blog post only showing category selection} http://www.new1450.dev/industries/development/ {a parent category} http://www.new1450.dev/industries/development/parent-category-i/ {child of parent} http://www.new1450.dev/industries/development/parent-category-i/child-category-i/ {child of child} http://www.new1450.dev/industries/development/parent-category-i/child-category-i/some-cool-post/ {actual post} This … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)