Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   New Versions, & Updating (http://forum.bytesforall.com/forumdisplay.php?f=12)
-   -   [SOLVED] Workaround for PHP: <?php the_permalink() ?> (http://forum.bytesforall.com/showthread.php?t=15647)

damian Oct 14, 2011 01:58 AM

[SOLVED] Workaround for PHP: <?php the_permalink() ?>
 
Now that PHP is no longer allowed in Atahualpa theme options, I need a workaround. Can anyone suggest a substitute for the following?

<?php the_permalink() ?>

I have a bunch of social media buttons (Facebook, Twitter, Digg, etc.) that require permalinks for blog posts on multi-post pages.

Please note that I'm almost a total newbie when it comes to coding, so I need everything spelled out explicitly.

Thanks in advance for your help!

juggledad Oct 14, 2011 03:46 AM

If you need the php in a post, page or widget, you can use the exec-php plugin which allows php in those areas. It is just themes that aren't allowed to use it.

damian Oct 14, 2011 02:31 PM

Quote:

If you need the php in a post, page or widget, you can use the exec-php plugin which allows php in those areas. It is just themes that aren't allowed to use it.
I should have been more clear: I'm talking about PHP in Atahualpa Theme Options->Posts & Pages->Edit POST/PAGE INFO ITEMS->BYLINE: Homepage (for example).

Can PHP be executed from that section, or not?

I just installed the Exec-PHP plugin you suggested, and it still doesn't seem to be executing PHP, when included in the section I just indicated.

It would be a major, major pain to have to manually insert a bunch of html and php in every single blog post, which is why I'm trying to use Atahualpa Theme Options->Posts & Pages->Edit POST/PAGE INFO ITEMS->BYLINE: Homepage.

Is there a way to get PHP to execute in this section, or is there a workaround so I can implement social networking buttons that refer to permalinks and titles for individual posts on multi-post pages? Here is all of the PHP I'm trying to execute:

<?php the_permalink() ?>

<?php echo get_permalink(); ?>

<?php the_title() ?>

<?php $link = get_permalink(); echo urlencode($link); ?>

<?php $title = get_the_title(); echo urlencode($title); ?>

<?php related_posts() ?>

lmilesw Oct 14, 2011 02:53 PM

You can add a new widget area in those spots and then us a php aware widget in it.

damian Oct 14, 2011 02:55 PM

Great! Thanks!

I've never created a new widget area or used a PHP aware widget before. Would you mind pointing me in the right direction?

lmilesw Oct 14, 2011 08:42 PM

The instructions for adding a new widget area are in the Add New Widget Areas section of the theme options. To find a php aware widget you can search wordpress.org. For example I searched for php widget and came up with this one. So the steps are.
  • Add a New Widget Area per the instructions in ATO>Add New Widget Areas
  • Go to Appearance>Widgets and drag the php widget into the newly created widget area
  • Put the PHP code in the widget
I would suggest playing with these steps in a test site to get familiar with the steps.

damian Oct 25, 2011 02:15 PM

Awesome! Thank you!


All times are GMT -6. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.