How to change post slug manually

Posted on May 2, 2020

This is a documented change in the core package of Gila

The problem: post's slug (that show on post url) is generated from Slugify library but doesn't give the freedom to the user to modify it manually

If you have a version <1.4.3 you can follow the following steps

1 open the file src/core/views/admin/edit_post.phtml

2 first replace the line 44, now it gets the saved slug value

    $ql="SELECT id,title,post,publish,slug,

3 add in line 41 a 'slug' index with empty value for a new post,like that

    $p = (object)['slug'=>'','tags'=>'','img'=>'','title'=>'','post'=>'','publish'=>1,'id'=>(isset($_POST['p_id'])?$_POST['p_id']:0)];

4 add  after line 63 this block of code to print the Slug input box

    <div class="row">
        <label class="gm-2">Slug</label>
        <input class="gm-10" value="<?=$p->slug?>" name="p_slug"/>

5 replace lines 12-13 with this code, if slug input is empty from the user then only it will be generated

    $slug = $_POST['p_slug'];
    if($slug == '') {
        $slugify = new CocurSlugifySlugify();
        $slug = $slugify->slugify($title);        


A simimlar solution can be done for the pages (the file is src/core/views/admin/edit_page.phtml)