When do i need to get permalink structure of a specific post?
It’s used in admin context to display URL previews. When you change the slug of a post, the code that enables that mechanism is getting the format of the URL via that function.
It’s used in admin context to display URL previews. When you change the slug of a post, the code that enables that mechanism is getting the format of the URL via that function.
You can modify the global WP_Rewrite variable directly. add_action(‘init’, function(){ global $wp_rewrite; echo “<pre>”; var_dump($wp_rewrite); wp_die(); }); There are sevel properties you can adjust: $wp_rewrite->permalink_structure $wp_rewrite->use_trailing_slashes $wp_rewrite->author_base $wp_rewrite->search_base $wp_rewrite->comments_base $wp_rewrite->pagination_base $wp_rewrite->comments_pagination_base $wp_rewrite->feed_base $wp_rewrite->front $wp_rewrite->root $wp_rewrite->index $wp_rewrite->matches $wp_rewrite->rules $wp_rewrite->extra_rules $wp_rewrite->extra_rules_top $wp_rewrite->non_wp_rules $wp_rewrite->extra_permastructs $wp_rewrite->endpoints $wp_rewrite->use_verbose_rules $wp_rewrite->use_verbose_page_rules $wp_rewrite->rewritecode $wp_rewrite->rewritereplace $wp_rewrite->queryreplace $wp_rewrite->feeds And alternate removal functions: $wp_rewrite->remove_permastruct $wp_rewrite->remove_rewrite_tag
You can eventually add ID in $sql, then it will be easier to use get_permalink function in the foreach : <?php global $wpdb; $sql = “SELECT ID, post_title, meta_value FROM $wpdb->posts a JOIN $wpdb->postmeta b ON a.ID = b.post_id WHERE a.post_type=”page” AND a.post_status=”publish” AND b.meta_key = ‘_wp_page_template’ ORDER BY a.post_title ASC “; $results = $wpdb->get_results( … Read more
The function get_author_posts_url retrieves the url where the posts of a certain author are to be found. If you change the url, that doesn’t mean the posts are moved. In other words, you have moved a sign directing you to Buckingham Palace and expect that by doing so you also have relocated the palace. In … Read more
Well, WooCommerce documentation clearly states Please note: The product custom base should not conflict with the taxonomy permalink bases. If you set the product base to ‘shop’ for example, you should not set the product category base to ‘shop’ too as this will not be unique and will conflict. WordPress requires something unique so it … Read more
I think the best way is to create Theme Options and let the administrator decide which page is each one, with a dropdown for example. This way you can get the selected page no matter the environment.
I agree with @Milo it would be easiest to do it by having the Services Page as your top level page (parent) and then declare other pages as the Services pages’ children. You can do this on the page editing area in the WP admin area. Try not to mess with the permalinks as that … Read more
Try below code. <?php echo ‘<h1><a href=”‘.get_the_permalink().'”>’.get_the_title().'</a></h1>’; ?> Hope this will helps you. Thanks!
I have an idea, let’s see if it helps you. You may create separate pages for each pdf file and make Reports page as parent of these pages. Then inside the child pages, you can embed the pdf files with a PDF Reader plugin or simply using an iframe tag. Thanks
get_permalink doesn’t output anything, it returns the permalink. Your first call works because you use it within the_title, which echos its value along with any before and after parameters you pass to it. Change your second instance to: <?php echo get_permalink(); ?> or use the_permalink, which echos the value instead of returning. <?php the_permalink(); ?> … Read more