Tag Info

New answers tagged

-1

You can absolutely add a custom class to each menu item: http://sevenspark.com/how-to/how-to-add-a-custom-class-to-a-wordpress-menu-item


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

Why don't you add a custom body class to the page template which you can hard code into the template or add conditionally from your functions.php file like this: //* Add custom body class to the head add_filter( 'body_class', 'wpsites_body_class' ); function wpsites_body_class( $classes ) { if ( is_page_template('template-x.php') ) $classes[] = ...


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


0

I think you're going to have to dig around in the theme a little bit for this. Personally, I use custom fields for issues like this. 1.) On your post page click on 'Screen Options' (top right) and ensure that 'Custom Fields' is checked. 2.) On that same page, scroll down and add a custom field like 'Featured Image URL'. 3.) Find the template file ...


1

One common way to do similar task is creating a page template. For example: <?php /* Template Name: Reviews and Quotes */ get_header(); ?> <div id="content"> <div id="reviews"> <?php $reviews = get_the_reviews(); foreach( $reviews as $review ) { <?php <div ...


0

You could use a plugin like JSON API to create an endpoint on your WordPress installation and access it from your PHP site with Javascript. You'll still need to style it however.


0

Search Terms Dotifier: Here's one idea using the request filter to append "dotted" words of two or three characters that don't contain any dots, to the current search terms. So if your search string is for example: The LA Dreams it will become: The LA Dreams L.A. Here's a demo plugin to modify the default search: <?php /** * Plugin Name: ...


1

Yes you can. Straight from the codex The $wpdb object is not limited to the default tables created by WordPress; it can be used to read data from any table in the WordPress database (such as custom plugin tables). For example to SELECT some information from a custom table called "mytable", you can do the following. $myrows = $wpdb->get_results( ...


1

The problem is that your code, especially the global $post; and then $post->ID part is getting the $post_id of the page you are on from the $post global variable, not of the product(s) in your cart, which would be what you are looking for. Aside from that, the $args parameter of wp_get_post_terms has no argument taxonomy, besides you already ...


1

This is expected output from what you have in your code. Never change the main query for a custom query on any archive page or on the home page. Custom queries are always troublesome as the main query is quite specific on these pages. I would advice you to rather use pre_get_posts to alter the main query on that specific archive page or home page you want ...


1

There is the post type attachment, which is normally used to store information about files uploaded to WordPress' Media Library. Additional data can be saved into custom fields/postmeta. You definitely should look into that, if you decide to go with native WP tables. Another possibility would be to make those custom tables searchable, on the codex page ...


0

Extra bonus Easter Egg for those in need... After the foreach loop by adding... $output .= get_post_field('post_content', $related_post->ID); You will also get the current post content.


0

Ok guys found the solution myself (5 days later, oof) added below to help someone else in the future... foreach((get_the_category( $related_post->ID )) as $category) { $output .= "<a class=\"$category->slug\" href=\"".get_permalink( $related_post->ID )."\" title=\"" . $category->cat_name . "\">" . ...


0

A hacky way to do it is to do a string replace on the tmpl-attachment-details template: // See wp_print_media_templates() in "wp-includes/media-template.php" function wpse157297_print_media_templates() { $my_link = '<a class="my_link-attachment" href="my_link.php?url={{ data.url }}" target="_blank">' . __( 'My Link' ) . '</a>'; $nonimage ...


0

// This worked great for me so much thanks! I just adapted for what I needed. Right in template file, Sweet! global $wpdb; // QUERY HERE TO COUNT TOTAL RECORDS FOR PAGINATION $total = $wpdb->get_var("SELECT COUNT(*) $post_per_page = 10; $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1; $offset = ( $page * $post_per_page ) - ...


1

You can do this through the WordPress APIs without writing any MySQL. Use custom post types for your different content types and WordPress already handles subscriber registration, plugins like BuddyPress extend that. If you want more specific help please include some code.


1

You can use any of the parameters from wp_list_categories and the widget_categories_args filter You can style the output with these CSS selectors: li.categories { ... } li.cat-item { ... } li.cat-item-7 { ... } li.current-cat { ... } li.current-cat-parent { ... } ul.children { ... }


0

if your theme have not search-form.php file then you will create the file and add the custom css there. Because search widget is calling the get_search_form() function. First it will search the search-from.php file from activated theme folder. If there have no file then it will call wp's default search form. See the Codex


0

I had the same issue, and found three ways to solve it. Types is really hard to convince to read data out of a different post than the current one in the loop... That's the first solution, just create a loop using query_posts() and get the data there via types_render_field() as usual. Just remember to reset the query afterwards if you're doing this before ...


2

I think those of us who have been working with Wordpress for a few years have been guilty of doing this at one stage or another. I have had to make modifications to a plugin that was no longer being supported by the original author and had some compatibility issues with later versions of Wordpress. There are situations where editing an existing plugin ...


0

WooCommerce pages are just normal pages that are (optionally) generated for you. The pages themselves just stick a shortcode in the content. So your plugin should do three things: 1) Create a page. Use wp_insert_post to add a post. You'll want to specify post_type=page and post_content=[your_shortcode]. 2) Register your shortcode. Use add_shortcode to ...


5

In general you don't want to modify plugins, because you will loose your modifications next time you update them. It's a little bit different for themes, where you can set up a child theme. If the plugin is using the wp_mail() function to send out the emails, you might try to use the wp_mail filter to change the recipients. Try to write your own plugin to ...


4

The most important question which you must ask yourself is Am I the author of the theme or plugin?. If your answer is yes, and you are responsible for the up keep of the plugin or theme, go ahead and change it and modify as you like. If your answer is no, then you should not make any changes to it, not even a small thing as a simple dot .. The same goes for ...


1

If you want to add some custom HTML between the </h3> and the <form> tags, you can try the following: /** * Add custom HTML between the `</h3>` and the `<form>` tags in the comment_form() output. */ add_action( 'comment_form_before', function(){ add_filter( 'pre_option_comment_registration', 'wpse_156112' ); }); function ...


0

Work with the options found under Gallery > Other Options > Lightbox Effects ... "What must the lightbox be applied to?" These will allow other images not in the NextGEN Galleries to be opened into the Lightbox Effect you have chosen.


1

Could be as simple as using the full function in the template file: <?php comments_template( '', true ); ?> Be sure you have a comments.php file in the theme folder. And be sure you're using the full loop: <?php require('/the/path/to/your/wp-blog-header.php'); ?> <?php $posts = ...


0

There's at least 3 options to choose from: You can use the single CPT file name which you can grab from the source code in the body classes or a custom class which can be added directly to the single-cpt.php file or using a functions file with conditional tag. .single-cpt { your declarations } Or add directly to single-cpt.php file add_filter( ...


1

If you want all of the visual aspects of the second theme on that one page, you could do something like this. It's hacky and I wouldn't recommend doing this but it's your question! From where you say you're at now (separate header/footer/page.php) you simply need to update the URLs that call in the CSS and other support files. These may include a "pieces, ...



Top 50 recent answers are included