Rename page URL

I have tried some add_rewrite_rule magic and query variables and it worked. Thanks for the help everyone. If in case anyone want to refer the answer: add_filter( ‘query_vars’, ‘wpse26388_query_vars’ ); function wpse26388_query_vars( $query_vars ){ $query_vars[] = ‘custom_gallery_id’; return $query_vars; } add_rewrite_rule( ‘topic/([^/]+)/([^/]+)/gallery/([0-9]+)/?$’, ‘index.php?pagename=gallery&custom_gallery_id=$matches[3]’, ‘top’ ); I was able to solve my problem with this.

create gallery page for specific post id

If you want to get all images attached to a single post then you can use this if ( $images = get_posts(array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_mime_type’ => ‘image’,))) { foreach( $images as $image ) { $attachmenturl=wp_get_attachment_url($image->ID); $attachmentimage=wp_get_attachment_image_src( $image->ID, full ); $imageDescription = apply_filters( ‘the_description’ , $image->post_content ); $imageTitle = … Read more

Removing custom post type name in single article URLs

Use the post_type_link hook, like this for use hash in link faq is the example custom post type add_action( ‘post_type_link’, ‘wpse70763_post_type_link’, 10, 2 ); function wpse70763_post_type_link( $link, $post ) { $post_type=”faq”; if ( $post->post_type === $post_type ) $link = get_post_type_archive_link( $post_type ) . ‘#’ . $post->post_name; return $link; } then unset($wp_rewrite->extra_permastructs[‘faq’]) On the init of … Read more

Avoid too long words in a post title, post content or comment but only if its not a url

Thank you Milo, “word-break” alone wasn’t enough as it’s css3 only and not cross-browser. But I found this: .bloc_content{ overflow:hidden; -ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } It seems to to work in all cases I tested. Hopefully it would be cross-browser enough to solve the problem. Not sure … Read more

How to avoid duplicate Url for the home page

From the comments: What are your settings under Dashboard -> Settings -> Reading. Specifically, what are your Front Page Displays, front page, and posts page settings? And your reply: exactly this is the point, the client has used a Theme called Choice and in the Theme Frontpage Settings there is this page selected :”Welcome to … Read more

custom page url slug needs illegal ?id=1 for javascript

Here’s a potential solution using the page_link filter and testing for the presence of a meta key to add a query arg: function wpa84303_page_query_arg( $permalink, $page, $sample ) { if( $query_arg = get_post_meta( $page, ‘query_arg’, true ) ) $permalink = add_query_arg( ‘id’, ‘0’, $permalink ); return $permalink; } add_filter( ‘page_link’, ‘wpa84303_page_query_arg’, 10, 3 ); Add … Read more

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