Styles are not loading when changing permalink to %postname%?

What are you typing in the src=”https://wordpress.stackexchange.com/questions/82463/xxxxxx”? Do you have the absolute path or relative path to your style? If your not loading the CSS from your functions.php with wp_enqueue_style you should load it like this in your header to always get the correct URL to the file: <link rel=”stylesheet” type=”text/css” href=”https://wordpress.stackexchange.com/questions/82463/<?php echo get_stylesheet_uri(); ?>”> … Read more

Custom permalink to make a page respond properly

I found the answer by tracing through the wordpress code, wasn’t easy, this code is really a complete mess but hell, i made it through… The solution comes in 3 different parts: Register your custom post type / Custom permalink structure Generate your custom rules / Overwrite existing rules Overide the redirect canonical filter to … Read more

Leverage permalinks with AJAX

You can do that with html5 history API with which you can change the URL at the address bar whenever you want. Works on anything modern which is not IE, but maybe this utility will help with IE.

Permalinks of New Pages and their Parents

NOTE: The information below is somewhat inaccurate. My mistake. The Page hierarchy is shown in permalinks, and the article I linked to discusses changing it in Posts. Thanks for the correction, @Milo. Original Post: You may not like this answer, but WordPress doesn’t include page hierarchy in urls. It is for use in your theme … Read more

get_permalink to attachment not working

The Problem is that you query for Post Status null. Try setting this to publish or inherit, because get_permalink is a function for published items, not for any post status. This is because Permalinks to items with a status like draft should not be shown to the user.

Custom rewrites for pages and categories

If you want to have domain.tld/PAGE-NAME.php then you could just use %postname%.php as custom structure. // Edit As this approach seems to work for posts only, you might have a try with the structure /%postname%/. In addition, you put the following lines to your .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*).php /$1/ [R=301,L] </IfModule> // … Read more

wp_get_attachment_url not working

Add the PDF attachment ID as a custom field value, for example attached_pdf_id. Get the URL using wp_get_attachment_url(): <?php if ( is_user_logged_in() ) { $pdf_link = wp_get_attachment_url( get_post_meta( get_the_ID(), ‘attached_pdf_id’, true ) ); if ( $pdf_link ) { ?><a href = “https://wordpress.stackexchange.com/questions/89809/<?php echo $pdf_link ?>” >Download</a><?php } else { ?>Sorry, no link available. Please contact … Read more

custom permlink .htaccess file 404 Not Found error

If your WordPress installation is in the folder ‘sitename’, than this .htaccess should go in that folder. Not your theme folder. From the WordPress codex: WordPress’s index.php and .htaccess files should be together in the directory indicated by the Site address (URL) setting on your General Options page (http://codex.wordpress.org/Using_Permalinks)

Text in permalink

There is no template for “/widget”. Templates are about content types and not URL fragments. IMO your page hack is totally legit. Another way to handle this is to have a widgets category which is the parent of all other categories and change your permalink structure to /%category%/%postname%/

redirect old pages by .htaccess

%postname% is not a mod_rewrite rewrite tag. You are going to have to write out the path. mod_rewrite operates before WordPress, or PHP, gets involved. You don’t have access to any of that functionality. If your “contact” page– the page named “contact”– has ID 213 you shouldn’t have to do anything to redirect, though. This … Read more

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