I'm new to WordPress development and I saw a video on how to add featured images. For some reason it's not working and I can't really figure out why. The option for Featured Image is not showing at all, so I don't really know how to fix it.
I've tried googling to see if people have experienced the same thing and from what I've seen it's usually syntax errors, however I don't think I have that.
I've tried deleting and adding it on again, but to no avail. I've also tried adding an array as a second argument to add_theme_support() but still nothing. I've also tried having the add_action() function before the custom function, and that hasn't worked either.
Here is the code in the functions.php file:
function Image_theme_setup(){
add_theme_support('post-thumbnails');
}
add_action('after_setup_theme', 'Image_theme_setup');
Related
I don't know what is wrong with me. I just simple generated a file using build.reduxframework.com and then added in my Wordpress theme. Then added the following line to functions.php
if(is_admin()){
require_once(get_template_directory().'/core/admin/admin-init.php');
}
Good thing is the demo stuff is showing up. Now my $opt_name is for_test. In my header.php I am adding the following code.
<h2><?php
global $for_test;
echo $for_test['textarea-example'];
?></h2>
PS: textarea-example is the id of the field which is already added in the files I downloaded. But I don't know why it is not fetching the value in it.
is_admin() means that only admins will load that. So if you're logged out, your redux config will never load.
Best to just include it. Redux will take care of when it should run.
I get the following error on Wordpress when i click on the archive or tag pages on my sidebar:
Notice: Undefined property: WP_Error::$slug in
/opt/wordpress/wp-includes/class-wp-error.php on line 78
I don't know where i can look after it, but i think it's somewhere in archive.php.
(We're using a custom theme, but i didn't code it). Maybe it also has something to do with the Plugin we use (its called: Ultimate Tag Cloud Widget)
Can someone help? (I can also post the whole archive.php file, if necessary)
Thanks!
Dear you just replace the old file(class-wp-error.php) in you error directory and then see what happend...
I got this issue recently and i just replace may file again from the previous back and its work out...
May be you also got the solution go to your error directory and paste the file...Thanks
I am trying to modify an existing plugin and one of the modifications that I am trying to do is to correct the way buttons are displayed on a certain page. Currently it's like this http://cl.ly/image/1C1l1H3w0r22 (excuse me for pasting screenshot link, I couldn't paste it on here). I am trying to change it to this http://cl.ly/image/3F2e252y3c41.
The buttons are loaded, that is working. The action is taking place, that is working. The images are loading, that is working. But for some strange reason the $post->ID is not being loaded.
I am getting wp-admin/?print_pip=true&post&type=print_invoice&_wpnonce=e25508b9df when I should be getting wp-admin/?print_pip=true&post=2712&type=print_invoice&_wpnonce=e25508b9df. 2712 being the order number in this case.
I understand that the problem is this: -
wp_nonce_url(admin_url('?print_pip=true&post='.$post->ID.'&type=print_invoice'), 'print-pip');
Would be great if someone can help me figure out what I am doing wrong.
Fixed this problem. I wasn't getting the $post so fixed it by changing top lines with: -
function pip_woocommerce_alter_action_column($order){
global $post;
$order = new WC_Order( $post->ID );
I am working on a wordpress site and would like to clarify a basic concept that is definitely very important, and this is how to customize/extend a wordpress hook (at least that's what I think I want to do!)
As the real world example, I am setting up a wp-ecommerce site. When a user adds an item to the cart, I would like to do one or two more things than the original function does. Looking through the source, I find:
/wp-content/plugins/wp-e-commerce/wpsc-includes/ajax.functions.php
with the function:
function wpsc_add_to_cart()
I know I could simply edit the code right here, but obviously that is the completely wrong way to go about it as when the plugin is updated, I will lose changes. What is the correct way to extend a function that is part of a plugin, or wordpress for that matter?
Endless thanks in advance.
You can use the wordpress action hooks to resolve the code loss while plugin upgrade.
You can remove the function which is in plugin file by using remove_action hook and do your own code by adding add_action in your function.php file. So that you can customize your plugin code from theme's function.php.
Here are the examples to explain.I hope it will help.
http://codex.wordpress.org/Plugin_API
http://themeshaper.com/2009/05/03/filters-wordpress-child-themes/
I use a little supressed notice function (it lives in my child themes function.php page), for plugins that get irritating eg: please setup twitter account to use , this kind of warning is not useful at certain stages and sometimes just do not care for it.
function supressed_notices_active(){
echo '<div class="error"><p>Supressed Notices are active</p></div>';
}
if(function_exists('the_plugin_custom_function_call')){
remove_action('the_plugin_custom_function_call' );
add_action('admin_notices','supressed_notices_active');
}else{
function test_message_from_me(){
echo '<h1>show</h1>';
}
add_action('admin_notices','test_message_from_me');
}
So I create the supressed notice function to at least create a warning, so i remember.
Check if the target function exists with the function_exists($target_function) hook
then remove this action from running with the remove_action($tag,$target_function) hook
then just add your custom function with the add_action($tag,$target_function) hook (do not need to have a separate function this could just be a closure)
then else if the function does not exist either still run a new action or leave this section, it can be useful for testing to just add anything so you atleast get some feed back.
What you could try... Copy the function within the plugin file,
paste it into your themes functions.php file,
ie:
function wpsc_add_to_cart() {
global $wpdb, $wpsc_cart;
// default values etc..etc..
// new code here?
}
the only thing with this is, if the plugin is updated and that funciton is renamed or removed, changed or something you could start to run into trouble...
could you not ask the plugin developer to possibly add your requirements to it,
possibly for a small fee? but if your using it as your main shopping cart, then chances are, that small investment could be a good thing.
Marty
I've downloaded a plugin for tinyMCE I want to use in the CMS Silverstripe backend. I've tried to add the line in mysite/_config.php as told in http://doc.silverstripe.org/htmleditorconfig
HtmlEditorConfig::get('cms')->enablePlugins('../../textmetrics');
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'TextMetrics'); // positions plugin
And added the Plugin into /sapphire/thirdparty/tinymce/plugins/textmetrics.
That didn't work. So I tried to do the same as in /cms/_config.php where the configuration is set for the editor and put the plugin into /cms/javascript/tinymce_textmetrics. Then I tried to load with
HtmlEditorConfig::get('cms')->enablePlugins(array('TextMetrics' => '../../../cms/javascript/textmetrics/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'TextMetrics'); // positions plugin
I've tried to use insertButtonsBefore insteat of addButtonsToLine just to see if there was a problem.
But nothing happens at all.... not even errormessages and I don't know what to do. I need extra plugins to load.
Help appreciated.
Thx Spanky
I've learned now, to test if the plugin works without Silverstripe and if it does, you can use this way to add it in Silverstripe. This is how it worked for me.
Put the Plugin in /htdocs/cms/javascript/pluginname . Then add the following code to /htdocs/cms/_config.php
HtmlEditorConfig::get('cms')->enablePlugins(array('pluginname' => '../../../cms/javascript/pluginname/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'pluginname'); // positions plugin*/
It would be nice if TinyMCE would throw errors if it does not work, but apparently it doesn't. Neither does Silverstripe.