Comments on: WordPress Plugins: sCategory Permalink – select category for permalink generation https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/ In my blog I'll try to describe about interesting technologies, my discovery in IT and some useful things about programming. Tue, 08 Sep 2015 00:23:09 +0000 hourly 1 https://wordpress.org/?v=6.7.1 By: Несколько слов о постоянных ссылках в WordPress : Статья : Уроки WordPress https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-236333 Thu, 04 Sep 2008 08:16:06 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-236333 […] есть подрубрики, также имеет еще один недостаток. Как сообщает Дмитрий Штефлюк, для построения постоянных ссылок WordPress использует […]

]]>
By: Fusiongt https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-84940 Thu, 09 Aug 2007 10:52:24 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-84940 After using your plugin I’m noticing some bugs. It’s doing the opposite of what the original Word Press was doing. However, it’s actually very manageable this way! Here is how my site is setup and how your plugin is helping it.

My site has 3 main categories, let’s just say “A, B, C” and in them they have sub categories, “cat, dog, mouse”

The main categories have low # category id’s because I created them first. The way the original wordpress would work was that it simply would call on the lowest id #, as you very well know. But now with your plugin, it’s calling on the higher id # which works like this:

If category A’s ID is #10
and category dog’s ID is #22 (and dog is a sub category of A) here is how they show up.

In word press it showed up as http://www.test.com/A/title.html

With your plugin it shows up as http://www.test.com/A/dog/title.html

And that is exactly how I wanted it! This makes the categories very manageable because now I can simply add a new category and it’ll work right away.

With that said, I have not tested if it works without sub categories. I personally have a gaming site, so something like http://www.test.com/news/xbox/ is what I want. Either way, I think this plugin is a life saver

]]>
By: Dmytro Shteflyuk https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-32226 Fri, 30 Mar 2007 08:32:48 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-32226 Thank you, guys
I have updated plugin to version 0.2.0, and you could get it
here (yeah, I have changed its location, but old URL would work too). Later I will publish post about other plugins.

]]>
By: Caio Proiete https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-31151 Sun, 25 Mar 2007 23:13:17 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-31151 Hi Dmytro,

I’m one of the heavy users of your great plugin, and I’ve just found a bug on it, that occurs when someone posts a comment or a trackback on some post.

For some reason, the savePost function gets called on every new comment or trackback, and it ends up updating the post_meta table, and since there is no data to update, it updates to the first category of the post (thus loosing any child category you might have choosen to be the master).

I’ve solved it by just checking if we are on the “post” page, before attemp to save anything.

Here is the solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    /** Store category permalink in post meta */
    function savePost($post_ID) {
        /*
            Modified by Caio Proiete on 2007-03-25.
           
            Are we inside post.php or post-new.php?
        */

        if (strpos($_SERVER['REQUEST_URI'], '/post.php') || strpos($_SERVER['REQUEST_URI'], '/post-new.php')) {
            /*
                Yes, we are... It's Safe to save/update post_meta table
            */

            $category_permalink = $_POST['category_permalink'];

            $post_category = wp_get_post_cats('', $post_ID);
            if (isset($category_permalink)){
                $found = false;
                foreach ($post_category as $cid)
                    if ($cid == $category_permalink) {
                        $found = true;
                        break;
                    }
                if (!$found)
                    $category_permalink = $post_category[0];
                   
            } else
                    $category_permalink = $post_category[0];

            if (!update_post_meta($post_ID, '_category_permalink', $category_permalink))
                add_post_meta($post_ID, '_category_permalink',  $category_permalink, true);
        }          
    }

.

]]>
By: Dmytro Shteflyuk https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-30215 Thu, 22 Mar 2007 05:07:05 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-30215 Tobias, sorry for inconvenience, I really forgot about WordPress formatting … features. Currently I’ve adopted my code highlighting plugin to use it in comments. Check formatting tips above the textarea.

To insert code sample please use <code lang="php">$your_code = "here";</code>.

Thanks!

]]>
By: Tobias Schwarz https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-29925 Wed, 21 Mar 2007 05:04:07 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-29925 Hmm, my code is not appearing – any formatting help to post it?

]]>
By: Tobias Schwarz https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-29924 Wed, 21 Mar 2007 05:03:17 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-29924 Hi again, I’ve looked at your code and changed it by using this to select the first (in my case usually the only) category assigned to a post apart from the master-categories (here 1/16/32/33). There is a plugin that allows a main category that I am using. Having that and your category checkbox makes the admin panel unintelligible for the authors who aren’t admins. Too much stuff to do before posting a post. So I hope this simplifies it while still benefitting from your great idea and plugin –

::HLIGHT_BLOCK_1::

I’m sure this could be done far more elegantly by someone who’s more knowledgeable about php and WP, but it does the trick. Maybe someone else will benefit as well.

Thanks again!

]]>
By: Tobias Schwarz https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-29914 Wed, 21 Mar 2007 04:21:03 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-29914 Thanks for the plugin! I’m wondering, if, in the case of such master-categories, it wouldn’t be easier to simply define certain categories that are excluded from the permalinks instead of having to define that for all posts?

Thanks!

]]>
By: Caio Proiete https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-23694 Thu, 22 Feb 2007 23:46:36 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-23694 Great plugin! Works fine with WordPress 2.1 without changes.
Thanks for sharing!

Best wishes,
Caio Proiete

]]>
By: Dmytro Shteflyuk https://kpumuk.info/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/comment-page-1/#comment-23421 Wed, 21 Feb 2007 22:16:47 +0000 http://kpumuk.info/projects/wordpress/wordpress-plugins-scategory-permalink-select-category-for-permalink-generation/#comment-23421 Jayant, thanks for the patch. Will integrate it shortly. Plugin works with WordPress 2.1 without any changes :-)

]]>