Support » Fixing WordPress » Target slug in functions file

  • Hi all,

    I have no idea if you could help.

    I am basically trying to assign a value to a variable based on the slug of the page within the functions file.

    So I have a function that loads more posts using AJAX. All works etc. I need to change one value to be able to use this same function for each custom post type.

    So I need to check the page slug and if it’s called boutiques to assign my $postname variable to boutiques.

    I have manually assigned this variable like this:-
    $postname = 'boutiques';

    And that works but I need to assign it based on page slug. So when you are on say the /tourist/ page the value of $postname = tourist

    Any ideas?

  • The topic ‘Target slug in functions file’ is closed to new replies.