• Hello,
    I’d like to make links to pages like they’re made to the archives. So, for example, my permalinks is set to:

    /archives/%postname%

    I want to create a dynamic page which lets you link into it just like that, changing its behaviour. It’s a gallery page (I’ve made it, no problem – goes through a folder, outputs all the images it finds), and I’d like to be able to link to particular images in a similar style as to posts. So I desire to make links in this style:

    /<gallery name>/<image name>

    Possibly even more complex, in the style of /archives/%year%/%month%, I’d like to be able to link to /<gallery name>/<gallery type>, and /<gallery name>/<gallery type>/<image name>. The idea is that it still takes you to a WP Page, but that the PHP picks this up and makes modifications (eg. displays only that image category or that image).

    As I said, I already have a functioning gallery page. I’d like to extend its functionality. I have a basic grasp of PHP (I’ve modded quite a bit of code, template tags are easy, calling functions no problemo) but very little experience.

    The website: https://www.loinhead.net/
    archives/%postname% example: https://www.loinhead.net/archives/fable-2-milestone
    archives/%year%/%date% example: https://www.loinhead.net/archives/2007/01/
    A gallery page: https://www.loinhead.net/fable-2-gallery/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fel64

    (@fel64)

    Does anyone at least know how WP does it, if not how I can do it?

    Thread Starter fel64

    (@fel64)

    I figured out that I can do it using .htaccess, and redirect to a dynamic page. I have some .htaccess code but it doesn’t work; can someone please help?

    I want to redirect
    FROM: https://www.loinhead.net/fable-2-gallery/art
    TO: https://www.loinhead.net/?page_id=14&itname=art

    without the user noticing. This is the code in my .htaccess – I added the first few lines.

    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^fable-2-gallery/([a-z]*)/$ fable-2-gallery/$1/ [R]
    RewriteRule ^fable-2-gallery/([a-z]*)/$ ?page_id=14&itname=$1
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    Options All -Indexes
    

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fancy linking to WP Pages like in archives?’ is closed to new replies.