Articles of permalinks

Automaticly add slug to posts

I’m using a us/news/%postname%/ structure for my permalinks. This works great for regular posts. However, I have a few different custom post types, and I don’t want the us/news part in their slug. How do I have it both ways?

Sub-category and category in permalink structure

Is there any way (plugin or function), to include the sub-category and the category automatically in the permalink structure? I want an URL structure like this: category/subcategory/posttitle/

Is there a wordpress function that I can use to retrieve the current page that is loaded?

Suppose that I create a page in the admin section (under ‘Pages’) and I have permalinks turned on and this pages slug is ‘my-new-page’, then is there a WordPress function that will work outside the (blog) Loop that I can use in that page’s template on my theme that will retrieve that page’s permalink?

Why doesn't flush_rewrite_rules run on plugin activation?

I’m trying to flush rewrite rules in a plugin and it isn’t working. I have to go to permalinks -> save in the admin panel for the rewrites to flush. Can anyone see why? class SpektrixPlugin { public function __construct(){ add_filter(‘query_vars’, array($this, ‘add_query_vars’)); add_action(‘init’, array($this, ‘add_rewrite_rules’)); } public function activate() { flush_rewrite_rules(); } public function […]

Featured image fallback link to permalink

I use this to display the featured image for each post. If the post does not have a featured image, a generic image will be displayed: <?php if ( has_post_thumbnail() ) { echo ‘<a href=”‘ . get_permalink($post->ID) . ‘” >’; the_post_thumbnail(); echo ‘</a>’; } else { echo ‘<img src=”<?php bloginfo(‘template_directory’); ?>/img/fallback-featured-image.jpg” />’; } How can […]

redirect loop to page, can't find origin, can't remove

I have a new client who did “something, I can’t remember what” to her blog. Now when you visit the home page, it redirects to a page she created and deleted, “/road-maps/”. I have no idea why it started doing this, or how she got it to do this. She has no FTP access and […]

How do I get the permalink structure to work like this?

domain.com/rents/miami-dade/ domain.com/companies/miami-dade/ Then for, say rents/miami-dade/ I would loop through some different areas within miami, showing a list of rents for each area. For example: domain.com/rents/miami-dade/ would render something like this by looping through the areas in Miami: North Miami Beach rents table Hialeah rents table Cutler Ridge rents table I’d need to mimic the […]

Removing the redirect after changing a page's slug

On one of my pages I changed the slug to form a different URL. E.g. Old: http://example.com/old-slug New: http://example.com/new-slug WordPress has done it’s thing of redirecting http://example.com/old-slug to http://example.com/new-slug. I’d like to remove this behaviour as a plugin I am using makes use of the slug in question and the redirect overrides its behaviour. I […]

How to remove the index.php in the url?

I have installed wordpress in a subdirectory (blog). In the root directory I have installed Magento. Now the file directory is as following: app downloader includes media …. blog/wp-admin My server is nginx. When I set the URL in the wordpress Permalink Settings to: http://www.example.com/blog/index.php/sample-post/ … all the posts are available. Now I want to […]

Page-Linking Structure

I’m trying to create a custom WordPress theme from scratch. As you can see, my file structure looks like this – footer.php, header.php, index.php, about.php, and contact.php within my theme folder: I’ve completed the home page (index.php) and now I’m trying to create these other pages and link to them. But when I go to […]