New answers tagged

0

Add bellow code in your functions.php file. } add_filter('comment_form_default_fields','remove_comment_fields'); function remove_comment_fields($fields) { unset($fields['url']); return $fields; } add_filter('comment_form_default_fields','remove_comment_fields'); Refference url


0

You can use TGM Plugin Activation library to let the user know about required and recommended plguins that your theme depends on. Automatically installing plugins is not a better choice instead let the users know that X plugin should be installed and activated in order for the theme to work properly. If your theme requires a plugin without which it gives ...


2

In WordPress 4.5.3, there's a foreach in wp-includes/post.php on line 1177 and no others around it, so I'm guessing this is the one that's triggering the error in your install on line 1172. This is inside the register_post_type() function, and it's looping through the taxonomies argument that you're sending through. Well... that you were meant to send ...


0

previous_post_link and its sibling are pretty simple functions, so there's not a lot to play with if you really want to use these (if you're building a plugin and do not want to touch the theme, making you need a filter which isn't there). However, since you're talking about templates, I'm guessing that you're building a theme. That gives you another option,...


0

$content_width is a global variable that can indeed be used by themes and plugins to set a maximum width on content elements. Therefore it's always a fixed value in pixels. The plugins don't know about your css. However, this does not limit your possibilities in your theme. You can still set image sizes larger than $content_width and use them. Keeping the ...


-1

I found out what was causing this problem. I had a plugin installed called Simple Posts Generator which I used to generate 10 sample posts for testing purposes. Since I generated the articles all at the same time, the post_date value in the database was the same for each post, which confused Wordpress as to what post should come first. I fixed it by going ...


1

First, check the quotes: <?php echo do_shortcode('[enlarge_text small="A" medium="A" large="A" default_value="medium"]'); ?>


0

If you want to deregister css styles from your child theme's functions.php, I would suggest navigating the parent theme and search for the wp_enqueue_style() method applied for the style sheet you want to remove. For e.g if you want to remove app.css in your child theme, search for app.css in your parent theme and find the code that enqueues this style. ...


0

Your code is working exactly as it should. The style_formats filter allows you to add additional styles via class names. It is perfectly valid for an element to have multiple classes (and is not limited to only two). I've been working with the tinymce editor for years; and I can honestly say I have no idea what the "exact" argument does, exactly. I have ...


0

I eventually figured this out, I don't know exactly why, but it seems the issue was due to the original use of init, once i replaced it with 'wp_head' it worked correctly, my final code looked like this function change_default_galleria_header() { remove_action( 'storefront_header', 'storefront_header_cart', 4 ); remove_action( 'storefront_header', '...


1

For tree-like structures (e.g. nested lists) you can extend the Walker class: https://codex.wordpress.org/Class_Reference/Walker


3

There are specific functions like wp_list_categories() and wp_list_pages() along with some others which will do this for you but for arbitrary arrays, WordPress doesn't have a function to neatly print it out into HTML for you. You could simply write your own functions for this purpose if you really need to I guess.


0

Finally I found the solution in codex.... Interpreting the Error Message: If the error message states: Warning: Cannot modify header information - headers already sent by (output started at /path/blog/wp-config.php:34) in /path/blog/wp-login.php on line 42, then the problem is at line #34 of wp-config.php, not line #42 of wp-login.php. In this ...


0

My philosophy is that if you use a system like WP then you embrace it and do things the WP way. WP has plenty of hooks that let you override functionality and the flexible theme structure gives you almost total control over the output. So, I'd advise using a WP theme and WP built in menus. Your menu items will link to normal WP pages. The site will work ...


0

You should try this plugin. https://wordpress.org/plugins/insert-pages/ You can insert content of www.test.co.uk/park/leisure-village/overview/ page to www.test.co.uk/park/leisure-village/


0

If the javascript file is loaded from the admin dashboard, you can use this javascript function get the root of your WordPress installation. function getHomeUrl() { var href = window.location.href; var index = href.indexOf('/wp-admin'); var homeUrl = href.substring(0, index); return homeUrl; } Then just contact the path to your theme like below. ...


0

There is very little difference, security wise, between using a code that was developed somewhere else, or give a direct FTP access. Unless you are going to audit the code (which is unlikely) any developer can take control of your site, and maybe more, from the code and no FTP access is needed for that. In real life, people that install a plugin which they (...


0

Yes. It is entirely possible. Ideally, you have good backups of your site and you have hired a developer that you trust, and you have not finalized payment until the work is completed and tested. Assuming you are not able to fully trust this developer, have them send you the completed theme for you to install. You do not need to provide FTP access with ...


0

WordPress stores all the theme packages under the wp-content/themes folder. If your developer needs to work on his theme, you can simply allow him to access the specific theme folder inside the wp-content/themes folder. If you are afraid that the site may fail due to his changes, you can switch to another theme in the meantime from WP appearance options. ...


1

You can delete it from the footer.php file or you can hide the CSS that displays it which is better in case you update the theme as the footer.php file may get over-written. If you choose the CSS route, then paste the following into your CSS file: #site-generator { display: none; }


3

I am not sure if this is what you are looking for, but when you login into wp-admin and go under "Users" -> "Your profile", you have an option to hide the admin bar.


0

Personally I think keeping your mods in an array is a nice solution, but transferring them shouldn't be too difficult. Just loop through the array like this: $all_mods = get_theme_mod('thefunk_theme_options'); // retrieve array foreach ($all_mods as $key -> $value) { if (!empty($value)) set_theme_mod ($key,$value); // set array element as separate ...


0

This works for me tested on WordPress 4.5.2 function nand_filter_widget_titles($title) { if ( $title != '') { $title = '<span class="icon-someicon">' . $title . '</span>'; } return $title; } add_filter( 'widget_title', 'nand_filter_widget_titles' );


0

In wordpress a translation is part of the code. If you change translations you should track the .po files in "git" as if it was any other kind of code. An alternative option is to override the textdomain used for translation and use another one that uses another .mo file located at some "safe" location. But this is just a band-aid over the "translation is ...


0

The moment an image is inserted in a post, the hook image_send_to_editor is called. The input to the hook is the html and perhaps also a caption shortcode. Like this: [caption id="attachment_999" align="alignright" width="150"] <a href="http://www.example.com/wp-content/uploads/2016/06/my-image.jpg"> <img src="http://www.example.com/wp-content/...


0

Agree with the Hugh Man that it is better to check the option before echoing the link, but it is possible to set the static page as a front page and leave the posts page empty. In this case, the link will just point to the home URL. A better approach is to provide a fallback to the posts archive page. Something like this: function slug_all_posts_link() { ...


0

I'd say there are roughly two approaches to this: 1 Use get_template_part(). This is the normal way of inserting pieces of code into a template. However, you cannot pass arguments to this function. So if you want to repeat ten pieces of code with small variations, you cannot tell get_template_part what the variations are. It is possible to get around this: ...


1

What you're getting is an array so you need to implode() them - the Walker_Nav_Menu has something like this: $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) ); So you can modify your foreach to implode them in a similar fashion $class = esc_attr( implode( ' ', apply_filters( '...


-1

Just to the point.. In wp-config.php paste this code-line set_time_limit(180); set your recommend execution time (PHP Time Limit) and done!.. Important: Paste before /* That's all, stop editing! Happy blogging. */ That's all. Never forget this, Silence is golden :))


0

I have copy-pasted your function into my dev install and your two controls show up in the customizer, both with a static front page and with a blog posts front page. So something is messing with is_front_page in your install. If I were you I'd echo the conditions in function to see if something is wrong there. It could be a stupid database writing error.


2

Once the widgets are being evaluated, the head of your site is completed, so you cannot use wp_head anymore. Adding <style> tags is an option, but will indeed generate a warning from the validator. Using the customizer is possibly confusing, because it is supposed to be about theme looks in general, not about specific widgets. You can however, make ...


1

I wonder if you mean to register a file-less template with the theme_page_templates filter like this: /** * Add a file-less page template to the page template dropdown */ add_filter( 'theme_page_templates', function( $page_templates, $wp_theme, $post ) { // Edit this to your needs $fileless_theme_slug = 'my_fileless_page_template'; $...


1

I still run into the desire to do this kind of thing and have settled on the following solution which I proposed in the OP and like for a couple reasons: It's very transparent and feels consistent with keeping the logic in the theme. It makes it very easy to customize a template later if needed. Custom Template Here's the entire template file if I don't ...


0

Put Template name (should be separate name) on page template php file (on toop). like this: <?php /* Template Name: Page Template Name */ ?> your file name can be template-your_template_name.php in theme folder or in subfolder in your theme folder.


0

You can put custom page template in theme: create "templates" folder in theme and put the page. First you check the admin panel and create new page display template name in "Page Attributes", like: If is not, then open archive.php in given this line: <?php /** * The template for displaying Archive pages * * Used to display archive-type pages if ...


1

Where to put custom page templates in theme? Custom page templates in page-templates folder are automatically recognized by WordPress.This folder is recommended for global or multi-purpose page-templates. You can check more organizing theme files on theme development handbook. but it does not work with my theme? Are you sure you have template files ...


0

As you have noticed already, $this will not work as you expected prior to PHP 5.4. You can read this in the PHP wiki. The reason: For PHP 5.3 $this support for Closures was removed because no consensus could be reached how to implement it in a sane fashion. This RFC describes the possible roads that can be taken to implement it in the next PHP version. ...


3

Try antispambot(): <a href="mailto:<?= antispambot('myemail.examlple.com') ?>"> <?= antispambot('my email') ?> </a>


1

The cookie is stored on the user's computer. The page is generated on the server. Somehow, you must make sure the cookie is transported back to the server when the user clicks on a link to fetch a second page. The instrument for this is javascript. You must send a script with the page that reads the cookie and adds the cookie content as a query_var to any ...


3

Since all _wp_render_title_tag does is check for title-tag theme support and wrap in <title> tags, there is really no reason why your existing implementation "shall not pass", since the proper implementation is already identical via: <title itemprop="name"><?php echo wp_get_document_title(); ?></title> when _wp_render_title_tag ...


1

The type of pagination you want to use is currently considered 'plugin territory'. Users that download your approved theme must not be forced to use it. They may, for instance, have another system of pagination which they prefer. Therefore a theme must have the barebones pagination of the_posts_navigation() as a standard. It's about ensuring flexibility to ...


1

Unfortunately echoing the <title> tag is currently hardwired in general-template.php (line 1062). It's in a private function, meaning that you cannot modify or overrule it. So, at the moment you cannot modify the tag. You might want to issue a trac to ask that they support this in the future.


0

Try do_shortcode( get_the_content() ); or apply_filters( 'the_content', get_the_content() ); in your post file.



Top 50 recent answers are included