Jump to content

Add a if else option and dynamic url option??


hash1

Recommended Posts

What im trying to do is make this into an if else statement so that if the "URL" is equal to the "http://www.someurl.com/" below then it echos the array like it already does. I want the else statement to just echo something like the file_get_contents array but minus the $category and $slug variables and also to have the url be dynamic so the original url can be any and not just a "set" url.

 

Or just have the below array be able to have any link instead of the set one.

 

I hope im explaining this right if not I apologize and can go into further detail.

<?php 
    $post_id = get_post($post->ID); // get current post or page
    $slug = $post_id->post_name; // define slug as $slug
    $category = get_the_category($cat_name);
echo file_get_contents('http://www.someurl.com/' . $category . '/watch-' . $slug . '.html?share=embed');
?>

 

Is there a way to do this? I've been stuck on this for awhile now, any help is greatly appreciated!

 

Thanks

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.