Tag Info

New answers tagged

1

This is called wp editor, which uses tinymce editor and odds. This editor can be called using wp_editor function. To display it on your options page, use wp_editor(); Like - $field_value = get_option('a_custom_textarea'); $field_name = 'a_custom_textarea'; wp_editor( $field_value, $field_name ); Ref - ...


0

You can modify a lot of form behavior by passing $args to the comment_form() function - have you tried that? Alternatively, you can write a custom comments template file and then use the comments_template() call to display it within the theme. This method would allow you to have complete control of the type, class, and ID of any field, provided that you ...


0

add_action( 'admin_footer', 'my_action_javascript' ); // Write our JS below here function my_action_javascript() global $wpdb; $pageposts = $wpdb->get_var("SELECT max(menu_order) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type ='post_trainers'"); ?> <script type="text/javascript" > ...


0

Did a bit more digging and it appears to have been a conflict in my theme: add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); function remove_width_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); return $html; }


0

You could for example change <?php next_post_link ( '%link &rarr;', '%title', true, '', 'category' ); ?> to <?php next_post_link ( '<div style="float: right">%link &rarr;</div>', '%title', true, '', 'category' ); ?>


1

You don't need to create custom php file to do that. Basically, Wordpress is for blogging. You just have to create a Category named Blog and create some post under Blog category and in your folder theme just create category.php to show all your post. I suggest you to have a look Wordpress Template Hierarchy. It helps you to build a custom theme for ...


0

Please learn how to template for WordPress first, before proceeding further. It will help you understand how you are proceeding and what you are achieving. Please note what is the Minimal requirement for a theme to BE a 'theme': index.php (not index.html) style.css That's it. It will work like a complete theme, and you can activate the theme without ...


1

I had a very similar issue. I needed to target a specific wp_nav_menu() and replace the a links with a class. Here is my solution in reference to the OP: function theme_add_menuclass( $classes, $args ) { if ( $args->theme_location == 'your-menu-location' ) { return preg_replace( '/<li /i', '<li class="your-class"', $classes ); } ...


2

the_widget() is used to display a specific widget outside of a sidebar. To be honest, this function serves no valuable purpose as you need to hard code the widget $instance parameters, this means that you will need to manually change the code every time you need to change something. So much for dynamica. It would just be easier to simply code a custom ...


5

Via using the dynamic_sidebar() you can change/edit the widgets in the widgets area of the appearance settings. If you use the_widget() you hard code it straight to template so you need to modify the code to change what is displayed. Both have their uses. Too many sidebars tend to clutter the widgets area, but is very good for users that don't want to mess ...


1

Your output is expected, but before I come to the solution and why's, you have a couple of issues here You are either using query_posts or nullifying the main query global which you should never do. The give away is your loop (if (have_posts()) : while (have_posts()) : the_post();) and the use of wp_reset_query();. You should be using a proper instance of ...


1

As I mentioned here those 2 ajax actions, here is how you can use the second action that extracts form values in db format Create an ajax action that will return the settings options You can add this code to {theme}/functions.php or to {theme}/inc/hooks.php function _action_ajax_fw_theme_get_settings_options() { wp_send_json_success(array( ...


0

You should be able to just use the default get_next_post_link with $in_same_term set to true. Have you tried that? Instead of your <?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'sixteen' ) . '</span>' ); ?> try this <?php next_post_link ...


0

looks like your navigation can be found in this function: sixteen_content_nav() I just guess, but have a look into this file: inc/template-tags.php


0

It is possible to install Composer and then install wp-cli . Under Alternative-Install-Methods it says to use wp-cli/bin/wp.bat, although I didn't like typing that path. After installing in the manner mentioned, I created a wp.bat in my WordPress root along side wp.phar with the following contents: @ECHO OFF php "wp-cli/php/boot-fs.php" %* Seems to work ...


0

Found this question doing my own research, and ended up developing a richer solution that I thought might be valuable. If you want to know the url of the media size selected by the user, then the following code (full jQuery code below) will do that for you: jQuery(function($) { // Bind to my upload butto $(document).on('click', ...


0

I answered my own question. I had the defaults set in the customizer settings, but not in the get_theme_mod() function.


1

This was driving me nuts, and I finally decided to search for where a page template's value is stored in the database. This gave me my first clue, because I found single-sponsor.php, the name of one of the other template files I'm building. I was confused as to why this could be the case, and looked at the HTML of the actual dropdown menu WordPress ...


1

There are many WordPress plugins that let you manage your email subscription. But overall this is not recommended, mainly because it creates a heavy load on the server. What will inevitably create a problem with the hosting service. In my experience, it is advisable to work with professional external services. For various reasons among which I highlight: ...


-1

@toscho's answer is totally wrong. Output buffering can be nested, there's no need to worry about other Plugins. In this post from 2009 there's a very elegant way to fetch and manipulate the final output of Wordpress.


0

// First, get associated taxonomies of the post/object. $object_taxonomies = get_object_taxonomies( get_post() ); // Next, get associated terms of the post/object. $object_terms = wp_get_object_terms( get_the_ID(), $object_taxonomies ); $terms = array(); // returned object terms could be WP_Error, so check that first. if( ! is_wp_error($object_terms) ...


0

Your html structure should look like <ul class="parent-class"> <li>Page 1</li> <li> <ul class="child-class"> <li> Sub menu item 1</li> <li> Sub menu item 2</li> </ul> </li> </ul> Wordpress should automatically add an "active" class to the active page then ...


0

Your plugin inserts its feelbox widget by filtering the_content: if ($options['showinpostsondefault'] == 'on') { add_filter('the_content', 'add_feelbox_widget_to_posts'); } But your index page doesn't display the_content, just Title, featured thumbnail, an excerpt and, number of comments. The plugin code you've shown us doesn't include a ...


1

I finally found out the short answer to the question 'Can you?' = Yes. Simplicity is an art. This moved me to dig deeper. It seems that the admin panel is not good at catching and displaying errors. What was happening was that the widget definition was throwing within broken markup. I could only see it if I viewed source.


0

This is rarely as simple as it sounds as new themes usually require some adjustment of the content (different image sizes? different menus?) and maybe new plugins or setting changes. It is not impossible, but the work required to actually be able to do it is different from site to site. Of course if all you do is CSS changes it should be easy to add a ...


0

Here's one idea: /** * Reactivate the sticky theme, if someone activates another theme. */ add_action( 'switch_theme', 'wpse_permanent_theme' ); function wpse_permanent_theme( $new_name ) { $sticky_theme_name = 'twentyfifteen'; // Modify this to your needs! // Get the sticky theme info, to check if it exists (named): $sticky_theme = ...


0

I just had this problem. This is how I fixed it... Pass $args = array( 'show_title' => false ); as a parameter. So yo would have something like this: // arguments for Theme My Login $args = array( 'show_title' => false ); Theme_My_Login( $args ); I was showing the login form in a modal so I used this to add the login form without the title.


0

http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install You have to COPY the index.php ot to the root and edit it to add the sub dir path.


1

It's doable with a user agent string "sniffer". Take a look at this project: http://mobiledetect.net Mind you, this approach can be troublesome as most modern browsers can 'fake' their user agent strings. Also, this approach doesn't work to well with caching systems. I've implemented it successfully on a project I worked on, and I know it's possible but ...


0

Since you add all the html in the post by hand, have you tried filtering the content? Similar to WordPress's <!--more--> tag, you could just add <!--my_headline_content--> Then: add_filter( 'the_content', 'my_headline_function_12378' ); function my_headline_function_12378( $post_content ){ /* * get your recent posts' data. You'll ...


0

Slightly hard to follow you here, but from the file you posted there is a line: $excerpt = implode(" ",$excerpt)."..."; Change it to: $excerpt = implode(" ",$excerpt); Edit - Corrected line, should work now.



Top 50 recent answers are included