New answers tagged

0

Okey, the problem is now solved. I had used both the parameters 'loop' and 'page' for the get_template_part function in the custom template's content php code. I removed the 'loop' parameter and ... voila , it works fine now.


-2

You need to add a function <script> function myFunction() { alert("I am an alert box!"); } </script>` Now, call this on success: $output = ''; $map = array( 'fu-sent' => array( 'text' => __( 'Your Video was successfully uploaded!!<a href="#" onclick="myFunction()">next</a>', 'frontend-uploader' ), ...


0

Create child theme of the main theme you're using. That way you can override just the parts you want. Reference - https://codex.wordpress.org/Child_Themes Hope it helps!


0

Just loop over WP_Query::$posts to get the titles: $option_posts = new WP_Query( [ 'post_type' => 'organisationer' ] ); $options = []; foreach ( $option_posts->posts as $post ) { $key = "option_{$post->ID}"; $options[ $key ] = apply_filters( 'the_title', $post->post_title ); } woocommerce_form_field_radio( 'custom_field', ...


0

What are your custom fields? As in, did you create custom fields using the built in way (under screen options > custom fields) or did you create custom fields in the theme customiser panel. You need to make sure that the template "employee-template.php" is calling the custom fields. There are different ways to get the info from different methods of making ...


0

You have to add more than one setting. Change $wp_customize->add_setting( 'img-upload' ); to two unique settings. i.e. img-upload-1, img-upload-2. Then call the settings in your code.


-1

The answer it seems was using 'RAND' instead of 'rand'.


-1

Yes,i am not getting you very well this may helpful. http://easywebdesigntutorials.com/creating-a-custom-user-role/


0

Thank you Gabriel for editing my question. I've moved a little bit forward on solving this, thanks to the explanation on both these threads: Remove ability to access certain admin menus & Hide Admin menus per role in Wordpress but i still haven't figured how to remove the option of creating a new post/page and tamper with the plugin Timeline Express. ...


0

wp_create_user is your friend! It takes a username, password, and email: wp_create_user( $username, $password, $email ); And here's an example: $user_id = username_exists( $user_name ); if ( !$user_id and email_exists($user_email) == false ) { $random_password = wp_generate_password( $length=12, $include_standard_special_chars=false ); $user_id ...


0

I FINALLY figured it out. Phew. Answer is as follows: add_action( 'woocommerce_after_subcategory', 'my_add_cat_description', 12); function my_add_cat_description ($category) { $cat_id=$category->term_id; $prod_term=get_term($cat_id,'product_cat'); $term_meta = get_option( "taxonomy_$cat_id" ); echo '<div ...


0

You can use uniqueid() from php. It'll generate unique id for your css selector. Or if you use any WordPress core pages like : archive, tags, category pages, please refer following article : 9 Way to Set Dynamic Body Ids via PHP and WordPress


0

I would suggest using Tools -> Export to save your posts and pages. Then you could reinstall your WordPress, upload your theme and Import your content back. This can fix corrupted WordPress core or theme files but you would have to setup your theme options and settings again.


1

You can make use of the queried object. On the blog page, the queried object will hold the page object of the page set as blog page. The following will work (This is if you just need to show this on the blog page) /** * Use $post as local variable in order use setup_postdata * in order to make the use of template tags available */ if ( is_post_page() ...


1

I know that this is an old question... but! there is a nice view count which means that people still need this. Maybe it would also help you close this question ;) Here is an ajax version The page itself the JS code The PHP Ajax receiver and publishing code. Inside your Page Template - this is an example - customize to your theme structure <div ...


1

In your example, $posts_page contains the ID of the page for posts, you can use that with any API function that accepts a post ID. For the featured image: $posts_page = get_option( 'page_for_posts' ); $post_thumbnail_id = get_post_thumbnail_id( $posts_page ); $url = wp_get_attachment_image_src( $post_thumbnail_id, 'your-custom-size' ); echo $url; And ...


0

There was an error in my code. From here: http://www.sitepoint.com/woocommerce-actions-and-filters-manipulate-cart/ Changing // correct quantity unset( $woocommerce->cart->cart_contents[$product_id] ); $woocommerce->cart->add_to_cart( $product_id, $quantity ); To // correct quantity // Get it's unique ID within the Cart $prod_unique_id = ...


1

I've found the solution. According to https://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior, one must add global $more; $more = 0; before the call to the_content(). So now my inner loop reads: <?php $recent_posts_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 5)); while ...


0

Have a look at the Codex about "Using Gravatars". There you´ll find a part about "Checking for the Existence of a Gravatar" which works like this: The trick to do this is to specify "404" as the default. In this case, the gravatar service will return a 404 error if no gravatar exists, instead of returning some default image. A real image will get a 200 ...


0

So here is a quick solution - with a bit of searching over SO and query analyzing : Keep the main query, but add a special filter for ordering. The filter (in function.php) : function my_posts_orderby( $orderby ) { $orderby = 'DATE(wp_posts.post_date) DESC, wp_postmeta.meta_value DESC'; return $orderby; } Note the DATE() mysql function that takes the ...


0

I found a function to get the Meta ID by Meta Key. This allowed me to correctly assign my $meta_ID variable, and now the delete ajax button works perfectly. No need to update the save function at all. function get_mid_by_key( $post_id, $meta_key ) { global $wpdb; $mid = $wpdb->get_var( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE ...


0

If you don't want to mess around with Wordpress nonsense of it ignoring taxonomies which clearly exist in the database, whether they be registered or not, you can just use a replacement function like this to grab the taxonomy at any time. function custom_get_terms($term) { global $wpdb; $out = array(); $a = ...


0

So, the actual problem was that I wasn't setting any defaults my custom widget needed to display any content. The widget actually was there, but as I had emptied the title and set no other defaults, it was rendering nothing. My fix for this was two-fold. 1) set at least one default in my install.php file update_option( 'widget_vvnumetawidget', array ( 2 ...


2

So I guess you've register your custom header within your child themes functions.php file: add_theme_support( 'custom-header' ); Next locate the customizer section and append your own setting/controls for the theme customizer. Let's say we want to register background_position and background_size and store it within an array custom_header_meta: ...


0

Here is what works for me. Not as clean but I couldn't get any of these other answers to work. Search form for Custom Post Type: <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> <label> <span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ) ...


0

It's your nonce generation and checking... You also weren't saving your audio link and I cleaned the setting of the meta up (sanitize the URL and fix the conditionals) This works locally for me <?php add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'Sermon', array( 'labels' ...



Top 50 recent answers are included