• Hi,

    I’ve got a code written in my template which determinates if a category with declared id has posts and if so it displays a table. But there’s a problem because when some other person imports my wordpress post database (exported from dashboard to xml) the category id’s are changing. I could use category names instead of id’s but i’d like to preserve availability of changing category name. Is there a way of giving category a permanent id or make it work in other way ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I was only thinking about a similar problem earlier today and wishing that categories had an option for custom fields. It would make this sort of semi-intelligent display so much easier and less prone to breakage.

    Are you making any use of the category descriptions? If not, you could use that field to house a keyword and then run a check on that instead.

    Thread Starter newkind

    (@newkind)

    That’s an idea but if you’re making a theme for someone else you’d have to inform that person that the category has to have description ‘something’ etc. so it’s troublesome … Hmmm … I guess the core team should think about it …

    I’m no php junkie so I have no idea if this would work or not, but would it be possible to code an umbrella if-then statement that would allow the code to simply look and then grab the appropriate categories-with-content without messing with category ids or category titles? Some other way of selection perhaps?

    I’ve wracked my brains over this one but so far, haven’t come up with a solution – which is a pity as one of my clients needs exactly this kind of functionality. Right now, I’ve created arrays of keywords and check for their presence in the category titles but that’s a far from perfect solution.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Permanent category id’ is closed to new replies.