Tag Info

New answers tagged

1

Before we start may I just quickly mention that for the future it is easier to reference the post by its ID instead of the URL as this is going to stay the same when slugs change. Anyway as you already have this shortcode now we need another solution. Your problem is that you need to find a post from its URL when the permalink changed. Fortunately the old ...


1

Use is_page(). The is_page() function accepts page title, slug or id. Documentation <?php if(is_page('myscript')) { include '/path/to/myscript.php'; } ?> UPDATE To add it to the content, you have two options 1. Find the content function in your template Find either the_content() or get_the_content() in your template. Place it immediately ...


0

with your code you completely redefine your CPT instead of just modifying the slug maybe this change the public access try this : $args = get_post_type_object("portfolio"); $args->rewrite["slug"] = "homepage"; register_post_type($args->name, $args);


0

Well, turns out now that I have access to the blog's admin control panel, that there's a really out of date plug-in being used to redirect to the main blog's mobile site. I can only make guesses at how it's breaking normal template tag behavior, but disabling it fixes the problem. So not quite as mysterious of a problem as it initially seemed to be.


0

The actual information - e.g. the 'slug' for the page or post is stored in wp_posts under the post_name column. This is a slugified version of post_title normally, but can be overwritten on a page by page basis. The full permalink is deconstructed based on what settings you have chosen in Settings -> Permalinks, but the actual slug is in post_name in ...


0

The template tags shouldn't return different values depending on the mobile browser. It's strange. Here are some usual suspects to check: Do you have any cache plugin installed? If so, disable it for your tests. Any .htaccess rules defined only for mobile browsers? That might explain different behaviors. Do you still get the right results on your computer ...


0

Ok i fixed that on my own but its weird. The problem starts when i create a custom taxonomy and assign that to a post, now i create two custom templates that serves as a archive page for my site with the help of wp_query and $_GET request.


0

You can use the the_permalink filter to modify permalinks. Take a look at the function reference for the same. Code sample from the docs: Append the query string for the current page to permalink URLs function append_query_string($url) { return add_query_arg($_GET, $url); } add_filter('the_permalink', 'append_query_string'); More information ...


1

WordPress uses the redirect_guess_404_permalink() function as part of its canonical api to produce these results: Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query. Will instead try to parse the URL or query in an attempt to figure the correct page to go to. You can disable ...


0

What's the page template filename? And what's the page name with you are using this page template? Remember that WordPress also looks for page-*.php to automatically apply that template to pages with that slug/id.


0

Just to confirm you have something like this at the top of your page template: <?php /** * Template Name: Unique Name for template * Description: Unique Description for template * * @package WordPress * @subpackage themename */ It might be worth checking your .htaccess file in the website root... 1) Make a backup copy of it. 2) Edit the ...


1

You're looking for: _wp_link_page( $page_number ); Must be used inside loop, and it return the opening tag: http://wpseek.com/function/_wp_link_page/


0

You might find the Redirection plugin interesting. It should allow you to change the permalink structure while keeping old URLs valid.


1

You can do this by checking the number of results returned by your query. Try this. <?php $rawfiltertag = get_post_meta( $post->ID, '_cmb_client_name', true ); $filtertag = sanitize_title( $rawfiltertag ); // wp_query arguments $args = array ( 'post_type' => 'post', 'meta_query' => array( array( ...


0

In your .htaccess you should be able to do something like what is shown by Chris Coyier on CSS Tricks. Link to example by Chris Coyier: https://css-tricks.com/snippets/htaccess/subdirectories-redirect-query-string/ Since you don't have .php in your URL, WordPress has most likely already created RewriteEngine rules for you to not need .php. But the result ...


0

Depending on how many pages that represents (the old ones), you might consider creating a rewrite rule for every single page with a permanent redirect flag. If this is not an option, I think mtinsley's answer is your best bet.


4

Your permalink structure is global; it is not a property of individual posts. There is no way to indicate that one post uses a certain permalink structure while another uses a different one. This makes sense when you think about how WordPress processes requests. Using the new structure, WordPress maps the request to index.php?name=$1 where $1 is the post ...


0

use the following code should get you through your problem. just pass the id of parent category in $term_id variable <?php $term_id = ; // id for the parent category $taxonomy_name = 'category'; $termchildren = get_term_children( $term_id, $taxonomy_name ); foreach ( $termchildren as $child ) : $term = get_term_by( 'id', ...


-1

You can create a new post type, under the name "post" and then add a rewrite slug. This will overwrite the default Wordpres post type. Here is a sample code: add_action( 'init', 'my_new_default_post_type', 1 ); function my_new_default_post_type() { register_post_type( 'post', array( 'labels' => array( 'name_admin_bar' => _x( ...


0

What helped for was permalinks reset. just go to Settings -> Permalinks, pick default, hit Save Changes. Then pick your structure and hit Save Changes again.


0

Just in case someone reads this after all this time (2011): I ran into the same issue, and after reading many posts, get back to my WP, and 'voila !' : It was working as expected ! this is a cache issue IMHO (WP 4.2.2). Cheers.


0

I've just had near enough the exact same problem and I'm in the middle of fixing it. In my case it's an inability to use the slug 'events' as any attempt redirects to an archive page with all archive results for events, for which I have a custom post type in fact. I've tried using a custom events page, I've tried using an events template applied to a ...


0

I ended up changing location ~ ^/.*\.php$ { try_files $uri = 404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } to location ~ ^/.*\.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } It ...


2

Everything after the ? is considered part of the query string. Everything before the ? is part of the pretty permalinks, aka rewrite rules. Rewrite rules are then processed to generate query variables. These are then plugged into a query ( which powers the main loop ), and a template is loaded based on this query. The parameters that come after the ? in ...


0

This sounds like a path info issue. http://wiki.nginx.org/PHPFcgiExample location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; ...


0

I can't say for sure without seeing all of your current rewrite rules but you can inspect them with the following plugin: (working for me on 4.2.2) https://wordpress.org/plugins/monkeyman-rewrite-analyzer/ My best guess is that your rewrite rules are instructing Wordpress to look for a page named "somemistakeword" that doesn't exist. The rewrite analyzer ...


1

It makes no difference performance-wise, if it did, there'd be something seriously wrong with WordPress. The same goes for Google, if a lot of super smart people earning 100k salaries can't write software that handles a trailing slash, then something is terribly wrong with the world. Either way, WordPress puts the rel="canonical" tag in the header so ...


1

Solved!, Change $postID by $post->ID, so, rewriting function: function noticias_print_permalink( $permalink, $post, $leavename ){ $external_link = get_post_meta( $post->ID, 'external_link', true ); if( !empty( $external_link ) ) { $permalink = $external_link; } return $permalink; } Regards.



Top 50 recent answers are included