WordPress.org

Ready to get started?Download WordPress

Forums

Target slug in functions file (1 post)

  1. obidos
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags