slug

pretty urls from database

独自空忆成欢 提交于 2019-12-12 12:26:46
问题 I am trying get pretty urls on my site..right now they look like this: www.site.com/tag.php?id=1 I want to change that to www.site.com/tag/1/slug my database table has ID,Title,Info,Slug I read online about slugs,but being new to php found no luck,can anyone help me with this. 回答1: First create an .htaccess file with the following: # Turn on rewrite engine and redirect broken requests to index <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST

Wordpress using get_term to retrieve slug not working as expected

霸气de小男生 提交于 2019-12-12 04:29:37
问题 I'm using the below code to try and get the slug for the current category and the parent category. I've managed to get as far as getting the currently cat slug but the parent displays in readable text and nut slug format. Where am I going wrong? <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $parent = get_term($term->parent, get_query_var('taxonomy') );?> <?php echo do_shortcode("[ecs-list-events cat='{$term->slug}']"); ?> <?php echo $term->slug;

stubs, dynamic homepage in cakePHP

一个人想着一个人 提交于 2019-12-12 03:55:51
问题 I'm working on a site for a client that wants to be able to update modifying their content. The brief was to allow them to edit pages, but not create or delete them. For the site I decided to work with cakePHP, as I've heard good things. First up, a quick explanation of my setup. I've got a single table, called 'contents', in which i'm storing each page's content. The table has a pid, a varchar 'title', a varchar 'slug' and a longtext 'body'. They're all pretty self explanitory, Each page

Custom Taxonomy Slug Hook? [closed]

♀尐吖头ヾ 提交于 2019-12-12 03:49:18
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . To avoid naming issues I decided to attempt to change the url slug as its being submitted, by appending a "unique-to-taxonomy" suffix. What is the hook for doing something like this? How would it be used? 回答1: I

Slug URL generation function overriding the Ç

北城以北 提交于 2019-12-12 03:45:00
问题 I have this function above to create url slugs from posts title, the problem is that the ç characther is not being converted to c . It is actually being override by the function. Example post title: Coração de Pelúcia The slug generated: coraao-de-pelucia How can i fix this function to generate the slug like: coracao-de-pelucia function generate_seo_link($input,$replace = '-',$remove_words = true,$words_array = array()) { //make it lowercase, remove punctuation, remove multiple/leading/ending

Codeigniter routing with slug gives me 404

你说的曾经没有我的故事 提交于 2019-12-11 17:27:15
问题 I'm working on a client website which part of it to retrieve news, this is my first codeigniter application and I have followed CI tutorials, slugs and routing. The problem I'm having is that everything works fine but when it comes to get a record based on slug I get 404. What I did was removed index.php from my URL and tested it, which works fine. This is my route.php $route['default_controller'] = "welcome"; $route['404_override'] = ''; $route['news/(:any)'] = 'news/singe_news/$1'; $route[

Wordpress - Page and custom post type with this same slug

流过昼夜 提交于 2019-12-11 14:59:51
问题 I have custom post type with "events" slug and page with this same slug ('/events'). When I use this same slug for page and CPT then I have 404 error - pagination. I changed "with_front" to true/false but this not work. I do not know what is wrong. My code: function mr_cpt_event() { $labels = array( 'name' => _x( 'Event', 'Post Type General Name', 'mr' ), 'singular_name' => _x( 'Event', 'Post Type Singular Name', 'mr' ), 'menu_name' => __( 'Events', 'mr' ), 'name_admin_bar' => __( 'Event Type

Wordpress: I Removed Parent Slug from URL but wordpress redirects and include parent slug again

感情迁移 提交于 2019-12-11 13:18:38
问题 I have successfully removed the parent slug from URL and have reduced the URL from: http://myexp.uphero.com/sample-page/child-sample-page/ to http://myexp.uphero.com/child-sample-pagee/ This is a test wordpress website for testing purposes. But when I visit the newly reduced URL, the old URL (with parent slug) appears again in the browser's URL bar. Please help me, why this it is including the parent slug again in the URL? I have search around the web but didn't find solution. Also, I have

create unique slug django

点点圈 提交于 2019-12-11 12:31:49
问题 I have a problem with creating unique slugs using django models. I want to allow the admin user to change the slug from the edit page in the admin. When a slug already exists there should be "slug + _1", "slug + _2" etc. Also when a new page is created and there is no slug given the slug should be the page title. I have this code but for some reason the admin keeps saying "Page with this Slug already exists." when I add a page with a slug that already exists. Hope somebody can help me def

How to pass two arguments id and slug with url (routing) in laravel 5.1

て烟熏妆下的殇ゞ 提交于 2019-12-11 12:11:36
问题 It's very simple But I don't know how? I want to show post id and slug in URL like "http://localhost:8000/blog/27/this-is-test-post" but it's not working My route Route::get('blog/{id}/{slug}',['as'=>'blog.single','uses'=>'PageController@getSingle']); My Controller public function getSingle($id) { $article=Article::where('id','=','$id')->first(); return view('/articles/article')->withArticle($article); } "i want to fetch data by id so i use here only id" My View when i Use this, URL is