• Is it possible to create dynamic pages on wordpress?, for example i create a country page , but inside the page i ask something like “if page is USA then show this photo and this query”

    I want to try this cause if i can’t do it, i’m gonna have to use a template for every page.

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes that’s possible, you can use conditional statements to do this:

    https://codex.www.ads-software.com/Conditional_Tags

    Thread Starter ulozilla

    (@ulozilla)

    thanks for the answer Christine, another question, if i have 25 country pages, i need to ask 25 times for different countries? or there’s a simpler way to do it?

    I think I need to know a bit more details about what it is that you’re trying to do.

    You could set up countries as a taxonomy or categories and then use that logic, but you will have to make a lot of queries yes.

    Alternately, you could use the page slug to pull up the right image. In your page.php file, you could include something like this inside the loop:

    <?php
    global $post;
    $page_name = $post->post_name;
    ?><img src="<?php bloginfo('template_url'); ?>/images/<?php echo $page_name;? >.jpg" />

    will insert an image with the page_slug name(.jpg) from the images folder in the theme directory

    Thread Starter ulozilla

    (@ulozilla)

    @transom that sounds very interesting.
    Christine what i want to do is for example , have a general page for 1 continent “South America” , that homepage will have a menu, sidebar, some content and a few pages(that will load the same menu). Then you have the country selector (Argentina, Chile, Peru, etc), on the country homepage you have a different menu and some articles related and a image(flag).
    The menu on the country homepage will change cause it will have country related content so the menu needs to know on which country i’m. Hope this explains a little bit my idea.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dynamic Pages’ is closed to new replies.