Tag Info

New answers tagged

0

You cannot do this type of sorting inside the loop. You can however be done by writing your own function Here is my solution: PS! Needs PHP 5.4+ STEP 1 Create a function called wpse161553_loop_sort($tag=''). This will work with a single tag with the main query. STEP 2 You need to get the post objects from the main query. They are already available and ...


0

To fix the empty input search issue you can substitute the function code with this: function template_chooser($template) { global $wp_query; $post_type = get_query_var('post_type'); if( isset($_GET['s']) && $post_type == 'products' ) { return locate_template('archive-search.php'); // redirect to archive-search.php } ...


0

Add a new input to the form, the name is key, you can easily access query vars that match a paremeter supporter by WP_Query using the function get_query_var. For example, you could try to generate an URL like this: http://example.com/?s=test&tag=5-personas,4-personas And with get_query_var(tag), you get the values, and the you create a custom ...


0

Figured out the answer! It turns out that in ACF, if you're using radio buttons and have key set for each value, the keys CAN in fact contain spaces! By matching the keys to the values (case-insensitive) I was able to get the conferences to display on the single-team posts.


3

I suspect what you're trying to do is implement related posts, and you're using post meta to indicate which posts are related to the current post. So if I have a handbag, and there are 5 related products, the handbag product has post meta containing the IDs of those 5 products. While this sort of works, it doesn't scale, and it isn't performant. Instead ...


0

To get them in the bar you could ignore the beautiful WP playlist ones and add your own using mediaelement.js directly, similar to this question. You basically extend MediaElementPlayer by writing buildXXX functions, and then specify them in the settings features property as an array (along with all the other controls). The following integrates them into ...


0

You can modify your menu by using walker. include('subMenu.php'); $menu = wp_nav_menu( array('menu' => 'YOUR-MENU-NAME','menu_class' => 'megamenu','walker' => new subMenu)); create a file subMenu.php in theme folder add below code. <?php class subMenu extends Walker_Nav_Menu { function end_el(&$output, $item, $depth=0, $args=array()) ...


0

in style.css, enter something like this: div.wp-playlist-prev{ width:20px; height:20px; background-image: url("./theme_images_folder/something_icon.png"); } same for the next button.


0

It would be better if you have posted your code, It helps in understanding what you are doing wrong & where you are stuck. You can use WP_Query to get the posts created by user in a specific category as well as a post type. To find posts of a specific category you can use the following snippet: $query = new WP_Query( 'category_name=staff' ); Where ...


0

Solved: Okay, figured it out. WP was trying to grab the CSS URL from the wrong address. It added a ".com" to the end in the settings. I corrected the URL, and now CSS is working. Thanks for all the help WP.SE! Cheers!


0

Turns out $wp_customize->get_section( 'sidebar-widgets-footer_widgets' ) was returning an Array, although a quick print_r() makes it seem as though it was an Object. Anyhow. Simple fix: cast it to an object. $footer_widgets_section = (object) $wp_customize->get_section( 'sidebar-widgets-footer_widgets' ); $footer_widgets_section->panel = '';


0

I have done a complete answer on this a while ago on SO. You can see the complete post here. For the sake of WPSE users, I have copied my answer from that post. I have not edited it, this post was originally about adding and displaying a nav menu to the footer, but the same exact method applies for a header nav menu. I hope you find this helpful ORIGINAL ...


0

Same pages as answer above "5 and 9" can also be hidden/removed from backend with PHP: function hidepages_php( $query ) { if( !is_admin() ) return $query; global $pagenow; if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) ) ...


0

Instead of specifying the menus you want to remove, specify the menues you want to keep :) add_action('admin_init', 'nwcm_admin_init'); function nwcm_admin_init() { // Remove unnecessary menus $menus_to_stay = array( // Client manager 'nwcm', // Dashboard 'index.php', // Users 'users.php' ); ...


1

I always find this tutorial to be a good reference point to make a completely bespoke login form: http://digwp.com/2010/12/login-register-password-code/ It's not a complete and concise answer to your question but hopefully it will get you going in the right direction


3

As @Tomas Cot says, this page has everything you're looking for: https://codex.wordpress.org/Customizing_the_Login_Form Specifically, this section is what you're looking for: Make a Custom Login Page So far you've seen how to customize WordPress' built-in login page. You can also create your own custom login Page by using the wp_login_form ...


1

You need to use get_field function here instead of the_field. function wrapImagesInDiv($content) { if ( in_category( 'projects' ) ) { $pattern = '/(<img[^>]*class=\"([^>]*?)\"[^>]*>)/i'; $replacement = ' <div class="owl-wrapper"> <div class="owl-item $2"> ...


2

You can use htaccess to disable public access. in your .htaccess file add this. AuthName "Secure Area" AuthType Basic AuthUserFile /path/to/htpasswd/file/.htpasswd AuthGroupFile /dev/null require valid-user don't forget to change htpasswd address in this. You can create .htpasswd from here. http://www.htaccesstools.com/htpasswd-generator/ ...


0

thats easy. I use a Pluing for this "Private Only" Go to add new plugins section and search for it. or visit its plugin site Private Only Have fun & good luck with your blog Note: I have no affiliation with this plugin :-)


0

Finally, I had to add the required code inside another shorcode I had in place to create the content structure. That way I avoided creating an extra shorcode and was able to put the custom code in the exact position I wanted. Thanks to all those who helped.


1

The WordPress built-in editor supports two editing modes, "Visual" and "Text." The "Text" mode allows you to directly edit the actual HTML of the page (or post), including any <div> elements that might be there.


1

The code you need will vary slightly depending on whether the Conference field is storing a text string (like "Big Ten") vs. the ID of the Conference post. I'll include both: Text String Example // place this code inside the loop of your single-team template $conference_name = get_post_meta( get_the_id(), 'conference', true ); $conference = ...


0

The best way to create dynamic data outputs really depends on the what, why, and how. For example, if you're creating a theme that creates its own custom post type, say, to store information about the head honchos that run the business behind the site, then just create a "single-$CPTNAME.php" template that has the code that you want. Another method of ...


0

Assuming you are looking for a solution to conditionally display your custom fields on public facing pages (non-edit page), you can use WordPress Conditional Tags. if ( is_page_template('template-name.php') ) { // Execute Your Code }


1

Create page templates inside your theme and create page-{template-name}.php for each one of them and you need to code the appropriate query for each case. Then go to each page inside admin panel, open each page and just assign each page to their matching template. If you are not familiar with how to do any of the above, provide the code of your current ...


-1

I have an idea! First, put the one copy of the list you want to edit into a widget with a text element. Second, place the widget on your page using a shortcode and this free plugin: Widgets on Pages Now, the same list appears on your site wherever the shortcode is placed!


0

You should call remove_meta_box in the add_meta_boxes hook to get it working. It tested on 4.0. add_action( 'add_meta_boxes', 'customize_admin_backend_cpt',0 ); function customize_admin_backend_cpt () { remove_meta_box( 'slugdiv', 'your_cpt_goes_here', 'normal' ); }


0

It is possible and quite easy to achieve. Here is how STEP 1 Copy content-featured-post.php to your child theme and open it up STEP 2 Just after line 32, paste the following code <?php echo get_the_date( 'Y-m-d' ); ?> Save this change, and your done As you can see, get_the_date is used to return the post date The get_the_date template tag ...


0

After here and there for long i find the solution for above : Replaced above meta tag with below <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <?php if($image[0] != "" ){ ?> <meta property="og:image" ...


0

What about using the u var to share your url and let facebook get the content using Opengraph tags? Something like this <a onClick="window.open('http://www.facebook.com/sharer.php?u=<?php echo $url; ?>', 'sharer', 'toolbar=0,status=0,width=548,height=325');" target="_parent" href="javascript: void(0)">Custom Share on Facebook page!</a>


0

jdm2112 and cybmeta are right! You are missing important functions 'wp_head()' and perhaps 'wp_footer()'. You'll need wp_footer cuz wordpress loads sometimes some scripts in it. In your front-page.php <?php // My Custom Front Page ?> <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta ...


0

// PLUGINS THAT ADD AS DASHBOARD SUBMENU // IF THIS IS THE URL BELOW - THE PAGE VARIABLE IS WHAT I NEED ( SO WHATEVER COMES AFTER PAGE= ) // http://example.com/wp-admin/index.php?page=iconize-plugin-update-notifier remove_submenu_page( 'index.php', 'iconize-plugin-update-notifier' ); // OR FOR EXAMPLE WOOCOMMERCE DASHBOARD SUBMENU ...


0

It sounds as though you are confusing multiple issues. If you created front-page.php, added your content and made the settings in WP for this to display as the front page, then that part of your question is answered. If the login form and slider are not working on that template, you have a separate challenge to overcome. The login form and slider are ...


0

Don't user custom fields to fix it, you should better try this: if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ){ $post_id = wp_insert_post( $my_post ); }


1

You need to add a control to it. function mytheme_customize_register( $wp_customize ) { $wp_customize->add_section( 'mytheme_options', array( 'title' => __( 'MyTheme Options', 'ppr' ), 'priority' => 35, 'description' => __('Allows you to customize some example settings for MyTheme.', 'ppr'), ) ); ...


0

This is what I did on a recent site: $blog_page_object = get_queried_object(); $blog_page_title = $blog_page_object -> post_title; $blog_page_description = apply_filters('the_content', $blog_page_object -> post_content ); ?> <h1><?php echo( $blog_page_title ) ?></h1> <?php echo( $blog_page_description ) ?>


1

I think what you want is to create what WorpPress calls "Custom Post Types". Please have a look at the Post Type page in the Codex that explains what Post Types are and how to create custom ones. Basically, here is the code to create the Object custom post type : add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( ...


1

May be you can try this: add_filter('manage_edit-movie_columns', 'custom_add_new_columns'); function custom_add_new_columns( $columns ){ $columns['author_email'] = 'Email'; return $columns; } add_action('manage_movie_posts_custom_column', 'custom_manage_new_columns', 10, 2); function custom_manage_new_columns( $column_name, $id ){ if ...


1

Just use CSS to style your #nav li block. This is quick, but would make your links into buttons. #nav li { list-style: none; background: #F00; width: 120px; margin-right: 60px; padding: 10px; text-align: center; } you can add a hover class too like #nav li:hover


0

Have a look at in_category() in the codex. You would either insert this into your theme within the post loop or create a function in functions.php that'll insert the image and text you want when a post from that category is displayed on screen. Here's a test bit of code I put together that works well in the Twenty Fourteen theme. I put it inside the loop ...



Top 50 recent answers are included