Tag Info

Hot answers tagged

4

The problem comes with using only numbers as URLs. Here is a forum thread in WP that discuss this issue. I'll cite Otto: WordPress 2.3 and up does not allow the post or page slugs to be all numeric. This is because that URL scheme will conflict with multi-page posts. There is no fix. Change them to something else. Alternatively, a plugin ...


3

For custom post types, use the post_type_link filter just a you would use the post_link filter for post post type posts


2

If we check out the source of the wp_unique_post_slug() function, then we see that this is expected for hierarchical post types, other than nav_menu_item. If we try for example the slugs 360 or page360, then the -n slug suffix will show up. We can play with e.g.: echo wp_unique_post_slug( $slug = '360', $post_id = '', ...


1

try this $post_id = 11; $post = get_post($post_id); $slug = $post->post_name; <a href="<?php get_site_url(); ?>/abstract/<?php echo $slug; ?>" title="<?php the_title_attribute(); ?>">Abstract</a>


1

My problem was solved with this link. It was very helpful and difficult to find. function add_custom_query_var( $vars ){ $vars[] = "brand_name"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); function add_rewrite_rules($aRules) { $aNewRules = array('brand/([^/]+)/?$' => 'index.php?pagename=hotel&brand_name=$matches[1]'); ...


1

you CANT have a PAGE and a CUSTOM POST TYPE with the same name Maybe tree years ago it was impossible, but now you CAN. First, add this lines to $args into your post type: 'has_archive' => false, 'rewrite' => array( 'slug' => 'your slug', // if you need slug 'with_front' => false, ...


1

Update You can make use of the add_rewrite_endpoint: add_rewrite_endpoint( 'schools', EP_PERMALINK | EP_PAGES ); You can then check in the sidebar for the schools variable: global $wp_query; if ( isset( $wp_query->query_vars['schools'] ) ) { // ... } What is worth mentioning is that your URL will look like ...


1

Permalink settings are available under Permalinks under the settings menu. I have faced a similar issue resetting the options here to non rewritten URLs and then back to the rewritten URLs should reset any issues with .htaccess file


1

Beside making certain categories to some domain. Why don't you create some post type like post-type-domainb and then redirect domain.com/post-type-domainb to domanb.com Please let me know if it doesn't work.


1

As per what I understood from your question, you want two things - Listing of all publisher Listing of all books of a particular publisher. Here is code for both. Listing of all publisher $terms = get_terms( 'pa_publisher' ); echo '<ul>'; foreach ($terms as $each_term) { echo '<li>'.$each_term->name.'</li>'; } echo ...


1

According to the official WordPress docs, when you save your Permalinks it updates your .htaccess file ... This isn't correct. When you switch from default-- ?= permalinks which are nothing but pure PHP URL parameter passing-- to anything else then WordPress will create a .htaccess file if it can, or tell you to create one. Once that file is created ...


1

I notice that to link to each post, I am calling get_permalink() and this is creating an extra DB query for each post. Not true. If you check the link to the very old trac ticket #18822 in the post that you have linked to, this issue was raised by @kaiser in 2011. The question was answered by @scribu For example: $posts = get_posts(); foreach ( ...


1

If it can help anyone, here is the full answer with the issues that might happen when you want to add Wordpress pagination with anchors to a template page. STEP 1 Follow the example on the Codex so that the paginate_links() function applies to your custom query and not to the main query. STEP 2 Your function should look like the code below : global ...


1

When adding an external link you need to include HTTP:// or HTTPS:// at the start of the URL to link to an external domain. Otherwise the link will be added onto the current domain.



Only top voted, non community-wiki answers of a minimum length are eligible