New answers tagged

0

I'm not completely sure what you are trying to accomplish, but here's what I think. Normally you would generate a link to a comment like this: echo '<a href="' . get_permalink($comment->comment_post_ID) . '#comment-' . (strval($comment->comment_ID)) . '">'; The problem with filtering get_permalink() is that the filter must know that it is ...


0

Looks like you want to keep you original articles intact but only have /blog for articles that are on your Page named Blog (i.e. You are not using Wordpress's blog home page and not using the usual Wordpress loop). To achieve what you want, you will need to add your own rewrite rules (via functions.php) for the articles you require and filter the specific ...


0

To use /blog/ as base of your posts you are supposed to use the Category Base option in your permalink settings. Go to Optional and enter "blog" into the Category Base


1

Here is what I ended up with. Needs some clean up on my end still but it works. https://gist.github.com/curtismchale/fa8d0570ce2c9b14880f31766c560872


0

After hours of debugging, I can't say exactly what the problem was, however disabling all the plugin solved the issue. It wasn't one particular plugin, I then re-enabled all of them and everything was fine. Thank you for your interest!


0

You can use template_redirect to force all the http traffic going through WordPress to use https: function force_secure_navigation() { if ( ! is_ssl() ) : $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; wp_redirect( $url, 301 ); exit(); endif; } add_action( 'template_redirect', ...


0

Update - Creating a class that mimics WP_Terms and copying over the objects returned by get_the_terms() to my *_Terms class worked. Passing in the returned objects when instantiating my class hits the constructor and builds out a copy of the properties that I have control over without worrying about core code changes: $categoryTerms = ...


0

Search the theme source-code for SITE_HOME_URL and try replacing it with WP_HOME or with the result of esc_url(home_url()). Locate THEME_PATH and replace it with the result of get_theme_root(). EDIT: In the case of expressduplication.co.uk/SITE_HOME_URLspecial-offers there is probably a wp_redirect() or wp_safe_redirect() that doesnt work because of the ...


0

Tjena Henrik! I think all you need to do is to add a rewrite rule to the Wordpress Rewrite rules that have already been created. Add this code snippet to your functions.php of your theme or include it as a separate pugin... add_action('init', function () { add_rewrite_rule('visningshus/?$','index.php?pagename=visningshus', 'top'); ...


1

You can only have one page at example.com so let's say you have an 'about' page: example.com/about In Wordpress Settings > Reading Settings you can select a static page to be the homepage, so example.com would now show the 'about' page. Now, go to Wordpress Settings > Permalinks and select Post name.


3

Your original solution was a hack, and no surprise it failed. In general never add methods/attributes to objects that you do not control their class and future development. The right way is to create your own object to be passed to the walker. Pass to it the category object on construction and either populate fields is a similar way to the category object ...


3

What causes /pages/ to appear in URI? As it turned out, you had a parent page with slug pages. How to remove it? Don't have a parent page. is there an easy way to prevent child pages from showing the parent page in the URI? This has been asked and answered countless times, for example here, you can find more here. Im not going to duplicate ...


0

You will need a plugin that uses 301 redirects to steer old permalinks to the new ones. Just search for 301 in the WP plugin directory.


1

Best way to check the option before setting the permalink is as follows: if ( get_option( 'page_for_posts' ) ) { echo '<a href="'.esc_url(get_permalink( get_option( 'page_for_posts' ) )).'">'.esc_html__( 'Blog', 'textdomain' ).'</a>'; } else { echo '<a href="'.esc_url( home_url( '/' ) ).'">'.esc_html__( 'Blog', 'textdomain' ...



Top 50 recent answers are included