Tag Info

New answers tagged

0

It looks like you have all the pieces you need to make this work - you just need to connect them. Try the snippet below /** * get_post_meta returns either the value of the custom field or false * so we need to be sure we have the string before trying to output the shortcode */ $meta = get_post_meta($post->ID, 'intSlider', true); ?> <div ...


0

I think that your concept is wrong here from what I can read from your comment to the other answer. You will most probably be better off by doing the following Use WP_Query, or even better get_posts to order your posts by last_name (if you are going to use pagination, rather use WP_Query). Funnily enough, I went and sat down and thoroughly tested a ...


0

Apparently you can with the Genesis Framework by setting the width #wrap {width:960px;} and remove all viewport css. Note: Do this on child theme. I read this on a developer's forum.


0

If you want to use one file as a "taxonomy" template, but want to style posts differently by post type, I'd advise using an if statement. I'm not sure how far you're going, but if you're just changing the loop for example, it would look something like this: Using this question as reference. <?php while ( have_posts() ) : the_post(); if( ...


0

Try something like this from another post: query_posts( array( 'post_type' => 'custompost', 'posts_per_page' => 4, 'meta_key' => 'mydate', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( array( 'key' ...


0

Working code: $display_count = 2; global $wp_query, $paged; $pages = $wp_query->max_num_pages; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $offset = $page - 1; $showposts = 10; $args = array( 'showposts' => 20, 'post_type' => 'any', 'post__in' => $WPIDs, 'orderby' => 'meta_value', ...


0

You will want to read up on get_post_meta(). Here is a link to the WP Codex reference for that function. <?php $meta_values = get_post_meta( $post_id, $key, $single ); ?> If you created that custom field with something like Elliot Condon's ACF plugin, the documentation for the plug-in is also helpful in meeting your exact need. Assuming you are ...


0

You probably want to use wp_get_post_terms(). If a product is always associated to only one category – which has no child if hierarchical – (what I understand from your example), adding below snippet within your while loop should do it (not tested). <? $cat = wp_get_post_terms( get_the_ID(), 'department' ); echo '<span>(' . ...


0

Replace is_user_logged_in() with is_super_admin().


-1

Solved need to add the woocoommerce_before_shop_loop in order for the cart messages to display.


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


1

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


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 ...



Top 50 recent answers are included