PHP echo data from Wordpress page into sidebar widget
$10-30 USD
In Progress
Posted over 8 years ago
$10-30 USD
Paid on delivery
Hello,
I'm using the Sabai Directory plugin for WordPress ([login to view URL]) to create a directory on my website.
I have this installed and working properly.
The directory plugin creates a separate page for each each listing. On the listing page there is php which calls the data from the listing. For example:
Listing Title:
<?php echo $entity->getTitle();?>
Phone Number:
<?php echo $entity->directory_contact[0]['phone'];?>
E-mail Address:
<?php echo $entity->directory_contact[0]['email'];?>
Slug:
<?php echo $entity->getSlug();?>
I've created a custom contact form with Gravity Forms, and I've successfully added the php to hidden fields, so that when a website visitor fills out the form on the page, the php data is called into the hidden fields, and when the contact form is submitted, the listing's details are submitted as well.
The issue I'm having, and need resolved, I've added a PHP code widget to my sidebar. I want to add another contact form to the sidebar, but when I use the same php, for example: <?php echo $entity->getTitle();?>, in the sidebar it's not working.
I get the following error:
Fatal error: Call to a member function getTitle() on a non-object in /home/mainst67/public_html/wp-content/plugins/php-code-widget/[login to view URL](27) : eval()'d code on line 1
Warning: Cannot modify header information - headers already sent by (output started at /home/mainst67/public_html/wp-content/themes/enfold/[login to view URL]) in /home/mainst67/public_html/wp-content/plugins/sabai/lib/SabaiFramework/Application/[login to view URL] on line 96
I've contact the plugin developer for help. The plugin adds several widgets which use the listing info in the sidebar, but they say the php sample such as <?php echo $entity->getTitle();?> will not work in the sidebar with out additional coding.
<b> To Do</b>
This job will be to fix the php code so that the Listing Title, Phone Number, Slug,
and E-mail Address can be added to a hidden field of a form in the sidebar.
Example:
<?php echo $entity->getTitle();?>
<?php echo $entity->directory_contact[0]['phone'];?>
<?php echo $entity->directory_contact[0]['email'];?>
<?php echo $entity->getSlug();?>
Example Listing:
[login to view URL]
Dear Sir,
I am really interested to work on this project . I have very good experience of doing this sort of job, I can start the work now and can assure the best service from my end.
I am waiting here to discuss about your project , please come on chat.
Regards,