A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.

learn more… | top users | synonyms (2)

0
votes
0answers
10 views

Building large menu from many other menus

Can I use following script to build my primary menu which includes items of many other menus? Example: my main menu looks like this - -1 --1.1 --1.2 -2 and I have many other menus with ID = (1.1, ...
1
vote
1answer
14 views

Remove “Category:”, “Tag:”, “Author:” from the_archive_title

I have the following code in my theme's archive.php: <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?> This gives me titles like "Category: Russia", "Tag: ...
0
votes
1answer
7 views

Excerpt for pages not showing

I am creating a simple wordpress theme and need excerpts for pages. I have tried the code from many topics some resolved on 'wordpress SO' but nothing works. Because I created the theme from scratch ...
0
votes
0answers
15 views

Is there any wordpress function to update a random post every 10 minutes?

I' m looking for a function which can be inserted in wordpress theme function.php , when inserted , i want it to update a random post (which is already posted ) every 10 minutes . can this be done ...
0
votes
0answers
8 views

Restrict Editing by Category

I've tried every possible user role plugin for this, but each of them no longer work with the latest edition of Wordpress (Role Scraper, Restrict Categories, Advanced Access Manager, etc). If a plugin ...
0
votes
0answers
19 views

Custom function to add a secondary logo

I'm looking to create a custom function in order to be able to change/load a new image from the "customize" panel (this because I won't be the one who manage the website, so I'm trying to made things ...
0
votes
0answers
9 views

Rotate image media item 90° anti/clockwise ajax front end function?

Is there a rotate image function that I can create a button on the front end of my website, using ajax inconjuction with the id number of the media item? I'm thinking having 2 buttons, rotate left ...
0
votes
0answers
10 views

Edit, Add or unset woocommerce user meta fields in the admin panel

I used the following filters and hooks (add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); add_filter( 'woocommerce_billing_fields' , 'custom_override_billing_fields' ); ...
0
votes
2answers
16 views

Assign category a default post type

This one has been bothering me for a few days now, so I'd really appreciate any help you can give me. Problem overview: I have a plugin which automatically creates a post and assigns the category ...
0
votes
1answer
16 views

Emailing Authors When Post Is Published

I have gotten the code to do this. However the theme I am working with does not save emails the authors input on the front end into the normal wordpress email. It instead saves it in a variable. ...
0
votes
1answer
25 views

Shortcode to get featured image of specific id post

So I'm trying to create a shortcode to get specific id and its featured image to display it in a specific page. I want to use shortcode to make it easier for the user to add any post in this page. ...
0
votes
0answers
22 views

Modify shortcode to work with custom taxonomies and slugs

I am using this code which works fine with posts but I am looking to modify it so that the user can specify in the shortcode: custom post type name taxonomy name slug of taxonomy category For some ...
0
votes
1answer
10 views

Extract and display user infromation on an automatically created page

Is there a way to get the block of code below to extract a list of given user information as it creates the page for the new user. It creates new page for new user as supposed but I'd like it to alos ...
0
votes
0answers
17 views

Override A Plugin Variable And Function Via Functions.php

Is it possible to override a variable in a plugin function without altering the plugin? The closest thread I found to answer this problem is this one : Pass A Value From Outside To A Plugin Variable ...
0
votes
1answer
66 views

Calling the first & last post by category in custom post type

I have custom post type for comics, called “comic” and have written a basic comic navigation. First —previous — (current) title — next — and last comic. In functions.php, this code calls for the ...
-1
votes
2answers
22 views

preg_replace function [on hold]

i'm stuck in the use of the preg_replace function. I'm searching for the attribute of data-playlist to make a link on it i'm calling the function in my content: <?php $id = get_the_ID(); ...
0
votes
1answer
37 views

Fatal error: Call to undefined function add_action() - an untouched problem

The question was asked many times in many ways, but unfortunately is not covered well in most of the answers. I'm having the same issue doing things using include-files. In my TwentyFourteen child ...
-2
votes
0answers
12 views

Unusual entries in Recently Uploaded CGI scripts that send email [closed]

I'm running a VPS and my cpanel sends me emails on recently uploaded cgi scripts that send email. /home/username/public_html/wp-login.php:402: if ( $message && !wp_mail( $user_email, ...
1
vote
1answer
23 views

Toggle User Roles with button

I don't know if this is possible, but I've got two user roles: Hero and Legend. When people subscribe to my website, they're assigned the Hero user role. I would like to be able to toggle users to ...
0
votes
1answer
28 views

Adding New Role

I have add new role in functions.php file by this code: // Add a custom user role $result = add_role( 'supplier_for_planvent', __( 'Supplier_For_Planavent' ), array( 'read' => true, // true ...
0
votes
1answer
12 views

Must filter functions receive all arguments passed to them?

I'm writing a filter function to redirect logins: function my_filter_func( $redirect_to, $requested_redirect_to, $user) { // My code. } add_filter( 'login_redirect', 'my_filter_func', 10, 3 ); ...
0
votes
0answers
26 views

How to edit wordpress source code? [closed]

I need to edit Wordpress source code like dashboard menu and it functions, i tried with Menu Editor Pro it works fine. but i wanted to change manually by coding . Can i do it ?
0
votes
1answer
12 views

Hiding all posts/products/pages from a site based on a custom taxonomy/domain name

I'm working on a site that's running Domain Theme Mapper (http://codecanyon.net/item/domain-and-theme-mapper) with WooCommerce to present two sites with two different child themes... that share a ...
-1
votes
0answers
16 views

Help me exporting this plugin code into functions.php [closed]

I'm using the Genesis WordPress framework and I like what this plugin do. The plugin's code is just about few lines, so what I want to do is to export the plugin's class code and use it directly in ...
-4
votes
0answers
28 views

How to add calculated text fields in woocommerce add product page? [closed]

I am working woocommerce v2.2.11. I like to add extra text fields under the Regular Price & Sale Price fields in Add New Product Page. The newly added fields contains custom values like 5% or 2% ...
0
votes
1answer
18 views

Styling admin page rows in order of importance (checkboxes)

I am altering a plugin's admin area and adding a checkbox for a "Coming Soon" option. As of now, when the user checks the "Coming Soon" checkbox, the entire row will turn green, but there is also the ...
0
votes
0answers
23 views

Load a Child Theme's style.css just before the closing </head> tag

I have this in functions.php: <?php /* Import parent style - The new standard Wordpress way - No @import in CSS! */ add_action( 'wp_enqueue_scripts', 'theme_enqueue_parent_styles' ); function ...
0
votes
1answer
24 views

wpautop - disable <br> tags, keep <p> tags

I write My articles in Emacs and they end up having tons of newlines, with double newlines to separate paragraphs. Ideally, I want wordpress to work like markup does, meaning it ignores single line ...
1
vote
1answer
18 views

Assigning WP functions which echo to PHP variables

I am creating a settings page. If I use the default example it works fine. <form method="post" action="options.php"> <?php if(isset( $_GET['settings-updated'])) { ?> <div ...
0
votes
2answers
57 views

Load CSS conditional on custom field is present

In my functions.php I would like to enqueue a CSS file conditional on whether a custom field exists on the page or custom post type. How should I go about this? function flatsome_scripts() { ...
0
votes
1answer
37 views

Can't wrap my head around this function - any help would be appreciated

OK so I am working on a theme that utilizes the customizer a lot. When you change a color for example, the necessary css gets added to the header, but when you click default, the css with the default ...
0
votes
1answer
16 views

Child theme - overriding add_image_size by a child theme [duplicate]

I am trying to get my child theme to work and to overide one line of code in the main theme functions.php but I can not getting to work since I am totally green in php. In my main theme functions.php ...
0
votes
1answer
25 views

Split single-review.php to two parts

I have a created a new page template which I want to use for my custom post types as well. I need to retain the existing format of my old custom post types but for any new custom post types, I want ...
0
votes
1answer
33 views

Custom Taxonomy Select Menu: Setting default option value?

I'm creating a series of select drop down menus that pull data from various taxonomies. I got this PHP script working for a WooCommerce attribute of color: function get_color_dropdown($taxonomies, ...
0
votes
0answers
24 views

Move next post link in PHP

I'm in a bit of a bother, given that my understanding of PHP is at a beginner's level, so could you help me? The problem is that my WP theme prints the previous/next post links at the top of the ...
0
votes
2answers
23 views

Do not add content filter on page template

I do not want to have a function loaded by my theme on a page template. Is this the correct syntax? What does 99 mean here? add_filter('the_content', 'oswc_formatter', 99); Could I apply the ...
0
votes
1answer
22 views

Trying to get property of non-object in: $wp_query

I've this function at functions.php file: function custom_secondary_nav( $menu_name, $id = '', $menu_title = '' ) { global $wp_query; // others stuff goes here if ...
0
votes
1answer
58 views

Modify shortcode to work with custom post types

I have this shortcode which works fine with posts but I need to modify it to take arguments for custom post type and custom taxonomy. <?php // [blog_posts] function ...
0
votes
1answer
27 views

WordPress HTML Helper

I've played recently with WordPress Hooks and I've noticed that in order to create layouts based on the hooks the main practice is to use html in functions and combine them with logic. I've searched ...
0
votes
0answers
22 views

“View Gallery” Button to open post gallery

I want to create a "View Gallery" button which opens the gallery attached to the post. I have tried: <div id="gallery-1" class="gallery"> <a class="attachment-thumbnail" ...
0
votes
1answer
14 views

Modify sub_menu function to show pages below a specifically set page

I've got a function that ties in to wp_nav_menu that shows sibling pages for the currently viewed page, as well as any children pages. I need this modified to only show the children pages of a ...
0
votes
1answer
16 views

Figure inlined width trigger distorted layout

I recently changed my theme to completely new one (fresh), and all my post images suddenly started to break my layout. When I inspect code all images and loaded content that are wrapped in 'figure' ...
0
votes
2answers
19 views

Changing the color of post title [closed]

Alright I am starting a music blog and I am working hard at coding up this theme but I am wondering why I can't do this successfully within WordPress when I know for sure it's possible. Alright so ...
0
votes
1answer
23 views

Creating A New Admin Menu Tab For Theme Options

I 've found an online tutorial that teaches how to implement a simple Options Page for the theme. I did it successfully but it is displaying as a sub menu, and I want it to be a main menu like those ...
1
vote
0answers
20 views

Customize default settings on new sites on multisite

As the title states i need an approach to change default settings when a new site is created on my wordpress multi site. I guess its easiest to keep the code in a mu-plugin but can a go about having ...
0
votes
0answers
18 views

using a function in functions.php to process a form generated in functions.php

so i have a site where users can rate items, it saves their ratings to a mysql db and also tallies the average for the item, saving that as well. as it is a generic function and there are hundred of ...
0
votes
1answer
21 views

Sort search with posts_orderby

I need to sort my search results by custom post type. the problem: the order is custom. I do have 5 different post types and i got the order like so: artist artwork page post publication I'd like ...
0
votes
1answer
34 views

Twitter Product Cards

I am trying to show twitter product cards. I have this function in my functions.php . I validated the twitter card and everything looks good except the product data. I am trying to display it for ...
0
votes
1answer
17 views

How to hightlight all ancestor menu items of a child page NOT displayed in menu

Here's the situation: In my main navigation menu I have something that looks like this: Work with Me Latest Projects Where the Latest Projects page is a child page and sub menu item of the Work ...
1
vote
1answer
24 views

What do the schemes login, login_post, admin, and relative mean?

site_url and get_site_url accept a parameter named $scheme. $scheme can be set to http, https, login, login_post, admin or relative. http and https are obvious. What do login, login_post, admin and ...