0

I've tried to use double quotes and single quotes with this php string. However, with no success. How can I call php within php?

<?php echo wpws_get_content('<?php the_field('rate_my_professor_link''); ?>','.comment','html','user_agent=Bot+at+mysite.com&on_error=error_show&')?>
3
  • 4
    Wait, what are you trying to accomplish? You cannot nest <?php ?>. Commented Jul 28, 2012 at 21:16
  • Just pass the function into the outer function as a param: echo wpws_get_content(the_field('rate_my_professor_link'),'.comment','html'....); Commented Jul 28, 2012 at 21:17
  • 3
    I'm pretty sure doing that would open up a rip in the space-time continuum. Commented Jul 28, 2012 at 21:18

1 Answer 1

4

You just need to do this:

<?php echo wpws_get_content(the_field('rate_my_professor_link'), '.comment', 'html', ''user_agent=Bot+at+mysite.com&on_error=error_show&'); ?>

You can put functions directly into other functions.

Sign up to request clarification or add additional context in comments.

5 Comments

Unfortunately this solution does not work. I had tried that before. :(
Well then something is wrong with the the_field() function; it may not be returning the correct data. However, I really think that something is wrong with the arguments in the wpws_get_content() function because of the complexity of the arguments. Try and isolate and simply the script.
the field argument works fine separately. The problem is that somehow the css of the page gets affected if I type the php in that manner. What I'm trying to go do is get a link from a wordpress custom field and put in the function above.
Just do this: $field = the_field('rate_my_professor_link'); and then echo wpws_get_content($field, '.comment',......);
I think your answer is a good partial answer. I think I should get the custom field value first and than use your solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.