Tag Info

New answers tagged

0

Its either your permalinks or inconsistent permissions on your server. You also might have to check replace all traces of your localhost in your database.


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 :)


0

should I copy the code from the link provided? http://codex.wordpress.org/Plugin_API/Action_Reference/after_setup_theme it's a twentytwelve theme, my theme is oxygen theme, how can I impliment the code? change the word twentytwelve into oxygen?


1

You can use the pre_get_posts filter to modify requested posts, this filter works in the admin area too, so you don't need to go to the trouble of creating a new post list table class First lets add a query var to the URL of your 'My Cases' page: function register_adminMenu(){ add_submenu_page('edit.php?post_type=case&mycases=mine', 'My Cases', 'My ...


0

XSS generally would only occur through AJAX or form handling. Verify a referrer header is actually from your FQDN and/or require a captcha, providing pseudorandom input validation.


0

use this plugin .. it allows guests to post without needing to login Guest Posts


2

You already have your updateYoutube() function. Edit it to insert a new post. Very generally: function updateYoutube( $videocode ){ global $conn; $run = $conn->query("SELECT `ID` FROM `youtubetable` WHERE `ID` = '$videocode'"); if ($run->num_rows > 0) return false; else { if ($conn->query("INSERT INTO ...


0

You need get_categories() with an include argument: if (isset($_GET['cat'])) { $this_category = get_categories( array( 'include' => $_GET['cat'] ) ); var_dump($this_category); } You will get an array of stdClass objects containing category data. There are several ways to parse that but this might do: if (isset($_GET['cat'])) { ...



Top 50 recent answers are included