Tag Info

New answers tagged

1

Thanks to the tipoff from @birgire in the comment, I was able to locate two things, an example of an implementation that includes context, here (also of note is that the Github gist has code for the very useful ability to access any image uploaded from this context previously! https://gist.github.com/eduardozulian/4739075 /** * Example of inserting a ...


0

This is the working code: // latest edition $taxonomies = array( 'jjm_editions' ); $args = array( 'orderby' => 'ID', 'order' => 'DESC', 'hide_empty' => false, 'number' => '1' ); $terms = get_terms($taxonomies, $args); foreach ( $terms as $term ) { $term_link = get_term_link( $term ...


0

If you are using posts (rather than pages) and categories, you could do this by creating a custom archive template for all posts in the category books. As an example, this is the category page of "Image of the Week" on a photography blog. http://blog.keithberr.com/category/image-of-the-week/ In this case I copied category.php and saved it as category-21.php ...


1

You have one big problem and then I would suggest a few suggestions on your code sidebar-widgets != sidebar-1 You register a sidebar with id sidebar-widgets but you are calling sidebar-1 You don't need to do this if (function_exists('register_sidebar')). register_sidebar is a core function, so it will always exist. It is not wrong, but it wastes space :-) ...


0

Your issue is the dynamic sidebar being called is not matching the ID of what is registered. Matching: <?php if ( is_active_sidebar( 'sidebar-widgets' ) ) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-widgets' ); ?> </div><!-- #secondary --> ...


2

You can check existing user with "username_exists" WordPress function and insert user using "wp_insert_user" function as below for Network site also: if(username_exists( 'username' )) { echo "Username already exists"; } else { echo "Username does not exists"; $userdata = array( 'user_login' => 'username', 'user_url' => ...


1

Assuming that you're on a page template or a custom page template, the first thing you want to do is grab the current page ID, then use that ID to grab the children. Once you have the children, display the content for those children. Try using get_children(); You can also try get_page_children but for my example, I'm using get_children: <?php ...


0

I have found the solution with this change this $html = '<input id="' . esc_attr( 'eo_theme_options[' . $id . ']' ) . '" to this $html = '<input id="' . esc_attr( 'eo_theme_options_' . $id ) . '" and it worked, that do the trick


0

I think you need to apply filters once you have added them: add_filter( 'parse_query', array( &$this,'shop_order_filters' ) ); // now apply the filter apply_filters('parse_query'); function shop_order_filters( $query ) { global $wpdb; if( isset( $_GET['filter_via_cat'] ) && $_GET['filter_via_cat'] != "produkte" ){ $cat = ...


1

@Mike94, Upon looking at your site I noticed this while viewing the style.css file (wp-content/themes/mima/style.css?ver=325): @font-face { font-family: Proxima; src: url(../fonts/ProximaNova-Regular.otf); } Thus, what is being asked for is wp-content/themes/mima/../fonts/ProximaNova-Regular.otf (which does not exist); however, I did find the font file ...


1

My solution. I added via functions.php the following: function my_login_logo() { ?> <style type="text/css"> .login #backtoblog{ float: right; position: relative; top: -35px; } </style> <?php } add_action( 'login_enqueue_scripts', 'my_login_logo' ); That code move to right side and a ...


1

As an alternative to filtering, this method would be used to replace <title><?php wp_title(); ?></title> in your header.php file (ideally in a child theme). bloginfo('name','description'); will display the site title and description. From Function Reference/bloginfo 'name' - Displays the "Site Title" set in Settings > General. ...


3

In any properly coded theme the title should be completely generated with wp_title() and easily filterable to specific string (in functions.php or otherwise): add_filter( 'wp_title', function () { return get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'description' ); } );


1

This is a simple code to add a form in a page: add_shortcode( 'myform', 'add_myform' ); function add_myform( $atts ) { if ( isset( $_POST['myname'] ) ) { $myname = $_POST['myname']; update_option( 'myname', $myname ); } else { $myname = get_option( 'myname' ); } $myform = "<form method='post' action=''>"; ...


1

There are numerous storage mechanisms in WordPress, issue mostly is you might not be making right calls which one to use until you get some practical experience with them. Very loosely they are (from more user–facing to more developer–facing): posts/page and custom posts types — for post–like content widgets and sidebars they are going in — for “blocks” ...


0

SPECIAL THANKS TO THIS ARTICLE: http://dotnordic.se/sorting-wordpress-posts-by-several-numeric-custom-fields/ $args = array( 'post_type' => 'property', 'tax_query' => array( array( 'taxonomy' => 'rc_repl_status', 'field' => 'slug', 'terms' => 'sold' ) ), 'posts_per_page' => 100, 'meta_key' => ...


0

Wow, no I didn't, but it makes me feel so much better about the solution I did come up with. Thanks for that reference. Again, the idea is just to programmatically create a path/url in a plugin for a WordPress site (like, "[mysite]/mypath"), and then load an arbitrary html or php file. In case anyone else is looking for something similar, this works for me ...


1

If you want to display a single custom field (post meta) then you can use: get_post_meta(); It has three arguments. The ID of the post The name of the post meta field (country_flag) Whether or not the value returned is a single string (in your case it will be); So the usage might be something like this: $country_flag = get_post_meta( $post->ID, ...


0

Supposing that each food item is treated as a post (perhaps even a custom post type), and the parameters (name/calories/etc.) are attributes of this post, you would do well to treat them as post meta fields. Various means exist to grant end-users the ability to maintain custom fields; my preferred option is Developer's Custom Fields, but other solutions ...


0

Here is a better solution: add_filter("user_register", "get_unique"); function get_unique($user_id){ $prefix = "PAY-"; do { $unique = mt_rand(); $unique = substr($unique, 0, 3); $unique = $prefix . $unique; } while (!check_unique($unique)); return update_usermeta( $user_id, 'memnumber', $unique );//$unique; } function ...


0

Then why don't you separate styles for both. So you can add styling for both differently. Like this. These are the styles for post/page title on inside pages #primaryContent h1 { margin: 10px 0 0; padding: 0; } #primaryContent h1.postTitle { font-size: 23px; margin: 0 0 20px; padding:10px 0; text-align:left; color: #b78a3c; ...


3

Here's a great codex article on the topic of creating administration theme: http://codex.wordpress.org/Creating_Admin_Themes And back to your question, you will want to load different stylesheets for different user roles, so you have to check who the current user is. Pay attention, the check is done using current_user_can() function and checking for ...


9

When you visit a fronted page WordPress will query database, and if your pages does not exists in database, that query is not needed and is just a waste of resource. Luckily WordPress offers a way to handle frontend requests in a custom way. That is done thanks to the 'do_parse_request' filter. Returing false on that hook you will be able to stop ...


0

I once used a solution described here: http://scott.sherrillmix.com/blog/blogger/creating-a-better-fake-post-with-a-wordpress-plugin/ Actually, when I was using it, I extend the solution in a way I can register more than one page a time (the rest of a code is +/- similar to the solution I'm linking from a paragraph above). The solution requires you to have ...


0

Add this in your functions.php function my_reg_page( $register_url ) { return home_url() . '/register/'; } add_filter( 'register_url', 'my_reg_page' ); This example would return a registration URL http://Yourdomain.com/register/ for the wp_registration_url() function


2

There are many choices here, and it is all up to you what you want to achieve and how you want to achieve it. My idea would be to use the templates available to avoid a lot of if else conditional statement. The Template Hiearchy makes provision for templates for terms, taxonomy-{$taxonomy}-{$term}.php, so you could create a tempate for each term. So for ...


0

FIRST BACKUP!!!!! NEXT, BE SURE THE BACKUP IS RIGHT Now, you can use this code in PHPMyAdmin UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'preview', 'edit') WHERE meta_key = 'dp_video_code' Make sure that's the correct name of the custom field, you can check it in the wp_postmeta table.


0

You should not use echo in this case. Please visit the function reference of get_template_part. As you will see, there is nothing to print: get_template_part doesn't return a value and doesn't warn if it fails to find a matching template file. Additionally, I recommend that you check out this question: Should we use get_template_part() in functions ...



Top 50 recent answers are included