Need help getting around the "variables can be passed by reference" error
I have finally found a way to generating a slug name that will call a specific post to show on another post’s sidebar!
$aside = $post; echo $post->post_name; do_action('after_aside', $aside); $aside = preg_replace('/(\-profile)/','-aside$0',"-aside"); echo $aside
So now I can have a post with a person’s name as the slug, and a post with the slug name-aside, that I can hopefully call up on the new sidebar.
While this is really great (although messy, the -profile bit works but I’m not sure why), now my problem is calling the new slug name to get THAT post’s contents!
When I do
get_post('aside') or get_post($aside)
I get the dreaded “Only variables can be passed by reference” message, which I don’t even understand, not being fluent in PHP.
From what I can gather, I have to do something to my little working bit to get it to work within the post call. I’ve tried making it a function (didn’t work)
what else can I try? Does anyone know?
(more info later if required)
- The topic ‘Need help getting around the "variables can be passed by reference" error’ is closed to new replies.