Theming Webform in Drupal - drupal

I'm trying to theme my webform but I can't seem to get the new webform_form_#.tpl.php to load properly. When I go to the node page I get a blank page on firefox with an empty body.
So in Template.php i've added the following line (my webform is on node 4)
function phptemplate_webform_form_4 ($form) {
return _phptemplate_callback('webform_form_4', array('form' => $form));
}
I have a webform_form_4.tpl.php in my sites/all/theme/forest_floor/ directory which is a copy paste from the modules/webform/templates/webform-form.tpl.php
I've tried following the guide here, but I still get nothing when I visit the node page. Yes i've cleared the cache.
I've also tried removed everything in the webform_form_4.tpl.php and just added the
echo form_render($form); like between <?php ?> and I still get nothing.
Any suggestions?

A blank screen aka WSOD is properly due to a fatal PHP parse error. Try checking your apache error log.

The link you are following on drupal node/79086 is for the older v4 of drupal Maybe this can help you http://drupal.org/node/335020

Weird it won't let me login to reply (for some reason) it doesn't think i'm the one who wrote the question.
Checked the apache logs
PHP Fatal error: Call to undefined function _phptemplate_callback() in template.php
Am I calling an old function?

Related

WP Media Library Grid View not displaying

Found this question: Wordpress: media library grid mode infinite loading
And, more recently:
"Currently I am using Enfold child theme but media grid view is not working. Even if I try to get to the grid from any of other places like selecting the featured image its not working."
From: Wordpress grid media is not working
I am having the exact same problem in WordPress (and also using Enfold). I have renamed my plugins folder to plugins.hold, disabling all plugins. I also set the theme to TwentySixteen. Neither of those things worked. The media library list view works -- only the grid view does not. (But, this is vital, since several elements pull the grid view by default with no chance to switch to the list view. This essentially renders those elements useless, as it is impossible to add an image.)
I realize this is more a WP question than a programming question, but I am hoping someone else has seen this and has a suggestion as to how it can be resolved.
I faced same issue on my wordpress site. After the lot of debugging i fixed my problem step by step.
First add given below code your db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
Then goto /wp-includes/js/wp-util.js files and find the code $.ajax(
options ) on line number 100(depand your wordpress version) insert given below code into your file
deferred.jqXHR = $.ajax( options ).done( function( response ) {
try {
response = JSON.parse(response);
} catch (Exception) {
response = response;
}
Please check your may be resolved.
if you Removed constant from db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
Then compress your /wp-includes/js/wp-util.js file code and put your compressed code into /wp-includes/js/wp-util.min.js
*change your own risk if your update your wordpress version changed may be lost.
Solution: Check the admin-ajax.php response, if there are non-json return or invalid json return you should investigate where the extra ajax response come from.
I had similar issue recently, after inspecting admin page the admin-ajax.php response contain non json response. It is because my client adding extra code in function.php that somehow append inline to the admin-ajax.php response
I had this issue recently and after trying all suggestion following worked for me.
Add following function in wp-config.php at top most line. If needed after that
than update permalink once.
ob_start();
For me, this happened after moving my site from an NGINX host to Apache. An old .htaccess file was lurking in the /uploads folder, which blocked access to any file in the uploads folder with a referrer that was not was my site (but, the http version, not the current https version). Because NGINX doesn't read .htaccess, this was now suddenly preventing images from being shown in the media grid.
Strangely, the images were showing in the list view. Also, directly requesting images was fine, presumably because that is done without a referrer.
Check the log error file in the wp-admin directory. If the repeating error is something like this
PHP Warning: ini_set () has been disabled for security reasons in
So, disable the ini_set function in your Cpanel (php selector> options> disable functions)
If the php selector option does not appear in your Cpanel, contact your hosting provider to fix this problem
Adding following code to functions.php of theme folder worked for me
add_action('admin_head', 'my_custom_style');
function my_custom_style()
{
echo '<style>
.media-frame.mode-grid .media-toolbar {
height: 60px !important;
}
</style>';
}

Integrating a Wordpress query into a PHPBB theme template

UPDATE: Managed to solve this by accident, answer is below.
I'm working on a site which requires several of the 'promoted' posts from the Wordpress blog to be displayed at the top of the forum.
(This is literally the only interaction between WP and PHPBB, there's no single sign-on or anything.)
I'm following the instructions listed here:
http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website
and here:
https://wiki.phpbb.com/Tutorial.Template_syntax
As such, I've edited my theme's overall_header.html file to include this at the top:
<!-- PHP -->
define('WP_USE_THEMES', false);
<!-- ENDPHP -->
<!-- INCLUDEPHP ../wp-blog-header.php -->
Later, at the correct place in overall_header.html, I need to call the actual php file which contains the query, which I do so like so:
<!-- INCLUDEPHP ../wp-content/themes/mytheme/heroarea-secondary.php -->
But when I load the forum, I get a fatal error which causes the page to stop loading, with the following error message:
Fatal error: Call to a member function main() on a non-object in C:\Apache24\htdocs\test\wp-includes\functions.php on line 808
Now I know there's not actually anything wrong with functions.php so I assume the issue is in my configuration, but I have no idea why it doesn't work.
If I create a seperate, standalone PHP file which just has this:
<?php
define('WP_USE_THEMES', false);
require('C:/Apache24/htdocs/test/wp-blog-header.php');
include('C:/Apache24/htdocs/test/wp-content/themes/mytheme/heroarea-secondary.php');
?>
Then that works perfectly without any troubles and pulls the correct three posts from the 'promoted' category as desired. But as soon as I try and replicate it in PHPBB, I get the fatal error listed above.
Can anyone point me in the right direction?
I've tried including wp-load.php and wp-config.php but neither make a difference.
I actually just now managed to solve the issue.
The solution is to add
define('WP_USE_THEMES', false);
require('path/to/wp-blog-header.php');
To the bottom of common.php in the phpBB root directory.
Hope this helps anybody else in the future!

Call to undefined function, get_settings wordpress

I have a Wordpress plugin with index.php that contains this line of code:
$plugindir = get_settings('home').'/wp-content/plugins/'.dirname(plugin_basename(__FILE__));
When I echo that code I get this output:
my.site.nl/wp-content/plugins/Tutorials
On the index page I also have a button that redirects to uploader.php,
inside uploader.php I have this code:
$plugindir = get_settings('home').'/wp-content/plugins/'.dirname(plugin_basename(__FILE__));
When I run the program I get an error that says:
Call to undefined function get_settings()
This error only applies on uploader.php, index.php works fine!
So it seems that I have to somehow let the uploader.php know that get_settings is a Wordpress function and it should recognize it, but I don't know how and I also don't know why the index page runs fine with the same code without including anything. I hope someone can help me out here.
index.php brings in all the WordPress functions as it loads. If you're loading another PHP file directly, you'll need to load in the WordPress functions by calling wp-load.php. See this answer (and the comments - you don't need to load all the files the answer mentions).
Try to use get_option('home') in place of get_settings('home') it may work.

Wordpress' Contact Form 7 returns 404 but works on homepage

I've installed Contact Form 7 (v 3.1.1) into Wordpress (v 3.3.1). It works fine on the homepage (which is a static Page called 'Home') but on any other page it does nothing and the console says:
POST http://trademarkshop.ca/contact/ 404 (Not Found)
I'm using do_shortcode to call it from both theme files:
<?php echo do_shortcode('[contact-form-7 id="212" title="Contact form"]'); ?>
I have wp_footer() in the footer and wp_head() in the header. I have no other plugins installed. I've even checked for if(is_home()) restrictions. I also tried re-directing other pages to use the Home page template file, but still gives a 404 error.
I've never had this problem before. Any ideas would be very appreciated!
have you tried changing your permalinks to something else,
then save,
then change it back to /%postname%/
could be its not creating the htaccess file in the wp root,
hence your permalinks arent working,
Marty
use this code
<?php echo do_shortcode( '[contact-form-7 id="7" title="Contact"]' ); ?>
His problem is caused by a combination of two misconfigurations. First, AJAX JavaScript is not functioning on your contact form. Due to this problem, your contact form needlessly redirects after submission. Second, your contact form uses unavailable words in the names of input fields. This issue confuses WordPress, resulting in the 404 (“Not Found”) error.
https://contactform7.com/faq/my-contact-form-always-redirects-to-404-error-page-after-submission/
Change your Contact form 7 field names. Because some names already using by wordpress may be is conflicting.
Example:
name to username
Sometime that happen cause the code (id) in de form (When you try editing the error message on the left side there is a short html like code on witch there is an id) is not the same as the one when you go to dashboard>contact and the short code entry of the table. You need to change the first one to match the second one

Wordpress goes blank after publishing new content?

So out of no where after clicking the publish button the page just goes blank...
The url at the top is:
http://www.brightboxstudios.com/sociabulls/wp-admin/post.php
What's good news is it still posts the content :)
Not great at coding so details rock :)
I was getting same error, when I update the site content and press update it goes to /wp-admin/post.php and this appears as blank page.
It is solved by:
I removed all the spaces at the end of functions.php file, I had included a widget and there were some spaces in between older content and new widget function, when I removed the spaces everything is working fine.
if that don't work then
- go into wp-config.php and find this "define('WP_DEBUG', false);"
change its value, if it is flase, make it true or if it is true change it to false.
And everything must work Good.
Thanks
A blank page usually means Apache failed. Check your error logs. You'll probably find a line that starts with:
PHP Fatal error:
You can also display your errors on the screen instead of looking at the log.
There will be many reasons for blank page, you have not mention version for wp, php etc.
To solve wordpress blank page issue follow the steps
disable all plugin and try (if there is an error in plugins then enable 1 by 1)
switch to default theme and try (if there is an error in theme)
rename .htaccess and param-link to default (page/post id)

Resources