WillBontrager
Forum Replies Created
-
Chevyman, I appreciate all the work you’ve done on this.
I’ll go ahead and see if I can duplicate the issue and perhaps work around it.
Thank you.
Will
Hi Chevyman,
Insert PHP will work only for code that would run without errors as a stand-alone script. Which excludes any WP hooks and WP-defined functions. (If you need WP hooks, it’s better written as a plugin.)
I’m interested to know if the following also interferes with Simple Press, or if the interference was because a WP-defined function was called:
[insert_php] $something = 'talking'; echo $something; [/insert_php]
Thank you!
Will
Thanks, Chevyman.
What was the code you put between [insert_php] and [/insert_php] tags? It might be something specific that interfered with Simple Press, which is what I wish to test.
Simple Press does look pretty cool ??
Will
Hey, thanks for the heads up.
What code did you run with Insert PHP? And how did you integrate it into Simple Press? I’d like to duplicate the issue, if possible.
Will
resolved
OK, looks like WordPress discards everything from the twitter page source code except the tweet and related info it publishes, provided the twitter URL is on a line by itself. As you noted, somewhere in the process, Insert PHP interferes.
This is a temporary fix:
At line 58 of the plugin’s insert_php.php file you’ll see
add_filter( 'the_content', 'will_bontrager_insert_php', 9 );
change that to
add_filter( 'the_content', 'will_bontrager_insert_php', 7 );
(The only change is the digit 9 to 7).
Verify the Insert PHP isn’t now interfering with any of your other plugins.
The digit can be brought still lower if needed for your current or future WP versions. But no lower than necessary to let it process the tweet page URLs. The digit is a priority number and the plugin shouldn’t usurp any priority it doesn’t actually need.
Will
Perhaps. At least I can have a look.
Post the PHP code you’re running with Insert PHP and also a tweet URL that breaks.
I’ll see what I can see.
Will
One more thing. This is not a forum on how to write PHP code, and I’m not going to let it become one. However, here is one more tip:
If you want to see the results of your SELECT query, you’ll need to fetch the data from $result with a function for that purpose, mysqli_fetch_assoc() for example.
Will
It’s how wordpress works. If you use the Visual tab and click update, it will convert characters to they are visual.
An alternative may be to put the PHP script in a separate file, then use Insert PHP to include the file in your post or page.
Will
Enter the PHP code in the “HTML” or “Text” tab (depending on which version of WordPress you’re using).
If you later go to the “Visual” tab and click the “Update” button, then yes it will turn > into > ; and < into < ;. Any & characters will also be converted to & ;
It’s what the Visual tab does – turns certain special characters into HTML entities to make them into visible characters.
If you need to update something with the Visual tab, then afterward you’ll need to go to the HTML or Text tab and fix the PHP code that had its >, <, &, or other special characters converted.
Will
Use mysqli_connect and its associated mysqli_… functions instead of mysql_connect.
Two reasons.
1. mysql_connect is being deprecated.
(See https://us3.php.net/manual/en/function.mysql-connect.php )2. I’ve found that accessing MySQL with my own code concurrently with WordPress using MySQL can fail when I use mysql_connect.
Will
Trisha, thank you for the information about the conflict. It is *much* appreciated.
Will
I’m assuming the OP resolved the issue as there was no response.
kamaleon, you’re a genius.
I’ll surely remember that fix.
Will
I’m sorry I’m unable to duplicate the issue.
My thought is to just not use Insert PHP, for now, while it is interfering with things. I’ll cogitate on it and maybe figure out a way to duplicate it so I can investigate.
Sorry I’m unable to help you right now.
Will