Tag Info

New answers tagged

2

You have misspelled the action hook name. This: add_action( 'after-setup_theme', 'ja_theme_setup' ); Should be: add_action( 'after_setup_theme', 'ja_theme_setup' ); The full code: add_action( 'after_setup_theme', 'ja_theme_setup' ); function ja_theme_setup() { add_theme_support( 'post-thumbnails'); }


-1

You need to go your wp-admin/post/ top right corner show "screen Options" click on this and expand screen-option then click on Featured Image check box Hope this help you..


-1

Your code should work , but as it is not working the try the following things add_theme_support( 'post-thumbnails'); Just put this code in functions.php , not within a function . Just put this code on the top of your functions.php file . If it is not working then try this plugin Drag & Drop Featured Image


1

You are not providing the correct parameter to wp_get_nav_menu_object() function. It needs the menu ID or menu slug but you are providing the menu theme location. Obviously, I can not tell you what is the ID or slug of your menu. One way of getting the menu ID of the menu assigned to theme location is using get_nav_menu_locations(): $menu = ...


0

Make all user author to contributor. After no user post directly you blog but submit article for review. Only Admin can publish.


0

If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved. How to create a child theme -> Wordpress Codex quick guide If you want to create functionality that will be reused in your another projects, create plugins. Thanks Vee


2

If you want to make changes to the template files (e.g. header.php, single.php, etc) you should create a child theme. Here's the Codex link to help you create your Child Theme


0

when you use a theme that will be updated, make a child theme you just have to copy the header.php from the parent to the child and the child version will be used by WordPress


0

OK I HAVE ALREADY!! yuuhuuu! Thanks a lot guys!! I have this: $args = array ( 'post_type' => 'product', 'posts_per_page' => -1, 'meta_query' => array( array( 'value' => 'demo', 'compare' => 'like' ), ), ); With this works atleast for me Thanks thanks!! Best regards!


0

You have written key as meta_value. It should be your meta name. The name you have given to your custom fields or meta. Then use the following query. $args = array ( 'post_type' => 'your-post-type', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'demo', ...


0

try something like this $args = array( "post_type" => "product", "meta_query" => array( array( "key" => "demo", "value" => "abc", "compare" => "EXISTS", ), ), ); $query = new WP_Query( $args );


0

Found a solution here. Just add this js code: var makeTabs = function(selector) { $( selector ) .find( "ul a" ).each( function() { var href = $( this ).attr( "href" ), newHref = window.location.protocol + '//' + window.location.hostname + window.location.pathname + href; if ( ...


0

to connect the user, you need this kind of code : $args = array( // args for searching the user ); $wp_user_search = new \WP_User_Query($args); $items = $wp_user_search->get_results(); $user = array_pop($items); // connecting the user wp_set_auth_cookie( $user->ID , TRUE // $remember ); // redirect to admin root ...


0

Ok i fixed that on my own but its weird. The problem starts when i create a custom taxonomy and assign that to a post, now i create two custom templates that serves as a archive page for my site with the help of wp_query and $_GET request.


0

To fix the error, you can do something like this: function new_modify_user_table_row( $val, $column_name, $user_id ) { $user = get_userdata( $user_id ); switch ($column_name) { case 'les-non-specialistes' : return get_the_author_meta( 'les-non-specialistes', $user_id ); break; case 'specialistes' : ...


0

What's the page template filename? And what's the page name with you are using this page template? Remember that WordPress also looks for page-*.php to automatically apply that template to pages with that slug/id.


0

Just to confirm you have something like this at the top of your page template: <?php /** * Template Name: Unique Name for template * Description: Unique Description for template * * @package WordPress * @subpackage themename */ It might be worth checking your .htaccess file in the website root... 1) Make a backup copy of it. 2) Edit the ...


0

If you want to be able to validate server side the easiest option is to use Advanced Custom Fields to define your custom field layouts, and then the Validated Field add-on to set your validation per field in the WordPress Admin.


0

You're correct in your approach. If you post your code will be better, but something like this: $args = array( 'post_type' => 'project', 'tax_query' => array( array( 'taxonomy' => 'region', 'field' => 'slug', 'terms' => $region, //set your region ), ), ); $the_query = new ...


1

This type of ordering is not available by default. You however have two basic options here rewind_posts() -> Rerun the loop multiple times and use rewind_posts() to rewind the loop so you can rerun it again EXAMPLE if ( have_posts() ) { while( have_posts() ) { the_post(); if ( $post->post_type == 'books' ) { // Output ...


1

Your question is pretty broad but provide your client with a custom role and only allow access to the specific pages you want, whether those are Core or created by yourself. That is how I would approach this. You will be working within WordPress and so retain its functionality for yourself but have a truncated interface for your client.


0

As what I've commented, the rawurlencode() function is the reason because WordPress have a lot of restrictions. I found that, that kind of problem will exist if you have a % percent sign (in my case, produced by the rawurlencode()) in your 'default' => $value. One of the solutions, encode some or the whole part of your path with base64_encode(): $encode ...


0

One of the solutions that I've found, is to store the set get_theme_mod($name) into a PHP $_SESSION["$name"]. If the session exist, compare the new get_theme_mod($name) to that old $_SESSION["$name"], if they're not the same then // do something..: // Check if the user is an admin for validation to improve performance. if (current_user_can( 'manage_options' ...


0

Yes, it's possible to have WordPress serve a different home page depending on the domain of the request. You'll need to do some setup: Make sure every domain you're planning on using is pointing to the server On the server, make sure the virtual host for each domain points to the WordPress directory. Alternatively you can just set the default web root and ...


0

You can check the user meta for the key you want: if ( get_user_meta('phone') !='' ) { echo "Your phone is not set"; } else { comment_form(); }


0

Thanks a lot. I have checked and i found that the problem is on the Theme-options code. i have used Option tree plugin inside of my theme instead of installing the plugin. But I don't know why it works on local and doesn't work on website.


1

This answer will be long, but can be helpful in some way. First of all, detect why you're getting this error: Majority of the time when you see a Wordpress' White Screen of Death, it means that you exhausted the memory limit of your server settings. This could be caused by a plugin that you may be using that is not functioning properly. It could also ...


0

The easiest way would be using get_post_field(): $post_author = get_post_field( 'post_author', $post_id ); For more details on this issue: have a look at this StackOverflow answer.


0

Found the solution. I am using get_next_post() and get_previous_post() functions which works perfectly.


0

There is a build in meta box to handle custom excerpts. You just need to check the excerpt option box under screen options in your post screen, once checked, you will see the excerpt editor box below your WYSIWYG editor metabox. For custom post types, make sure that you set the excerpt as support feature in your arguments when registering your post type ...


0

Add a custom field in your backend named excerpt_length (really simple, if you have issues, see this video). In your functions.php add this: global $wp_query; $postid = $wp_query->post->ID; $excerpt_length = get_post_meta($postid, 'excerpt_length', true); function custom_excerpt_length( $length ) { return $excerpt_length; } ...


1

This is how the sidebar works in Twenty Twelve There's 2 parts: Register the sidebar in your functions file using register_sidebar function your_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'twentytwelve' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', ...


1

The two functions at your disposal are register_sidebar and dynamic_sidebar - despite the name, they don't need to have anything to do with a "sidebar" in the traditional sense. As for the term "widget", this is nothing more than a chunk of code that takes some settings and outputs some content. A user can assign widgets to a registered "sidebar" area in ...


1

I heard about registering a sidebar that shows some content other than the main content(which I think sounds to me very similar to mine). Is this sidebar a functionality provided by wordpress itself or it has to do something with my theme's sidebar(which was created by me)? Nothing about this is provided by Core except for the basic sidebar ...


0

Hey here is a plugin that adds your own meta data to your pages https://wordpress.org/plugins/add-meta-tags/ Here is how to remove them. http://www.paulund.co.uk/remove-wordpress-meta-tags Let us know how you come along :)



Top 50 recent answers are included