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
1answer
27 views

expire wordpress user posts

I'm trying to make classified WordPress theme and I need to make users posts expire date plus show that date into the post. Users only allowed to publish their posts in post-types not as ordinary ...
0
votes
2answers
2k views

What is the difference between get_page_link and get_permalink functions?

Both functions return permalink to the post or page by it's ID. What are the differences and which of these functions should I use in which cases?
1
vote
1answer
501 views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
1
vote
1answer
813 views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
0
votes
0answers
22 views

Loop only displaying one post

After a WordPress update the following code started only displaying one post on the page. I thought something was deprecated so I updated the parts I was sure about. But I'm still getting pretty much ...
0
votes
1answer
1k views

How to access global variable $menu inside a class function

am puzzling why can't i access the global variable $menu inside a php class function class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; } } using ...
0
votes
0answers
5 views

My customizer's setting doesn't set to the default and needed to click the control's “Default” button before it'll be set

Here's my sample customizer's setting and control: $wp_customize->add_setting( 'themename_img', array( 'type' => 'theme_mod', 'default' => ...
0
votes
0answers
5 views

Using Isotope in WordPress portfolio

I'm trying to create a custom post type portfolio and use Isotope for filtering according to categories but I'm not doing something right. I've loaded scripts in my header.php, created a custom post ...
0
votes
2answers
24 views

custom post with loading script per single post

I read many Q&As here on SO...(and elsewhere but they don't count...lol) I think I follow the rules of WP.org but still it does not load the scripts. Scenario: Custom template for post in Php: ...
0
votes
1answer
333 views

call wp_insert_user in custom class doesnt work

im creating a custom class to manage users in wordpress and chamilo but this is not the point. Class looks like this: class Platform { private $security_key = '..'; private $secret_key; ...
0
votes
0answers
15 views

CSS not displaying

I found function for numbe pagination but when I trying to view the CSS thru Inspect element, the CSS for that pagination is not displaying. Even If I change the CSS style, its not working. How to ...
0
votes
1answer
44 views

Adding javascript to functions.php causes problems with my template

I want a "Read on" link that moves to another part of the page when clicked. I understand the HTML bit and I have even used some nice scrolling. It works. But when implemented breaks part of my ...
0
votes
1answer
14 views

getExcerpt: Make ellipsis appear only if character limit is reached

I have a function called getExcerpt that displays the first 140 characters of an excerpt and after that, an ellipsis appears. The call in my template is like this: <?php echo get_excerpt(140); ...
1
vote
1answer
53 views

How to store the_title() into a variable to reutrn the value, not just echo it

I have a loop, and need to pass one more argument through it. I need to get the current page's single post title, and then use that as the value. I tried going about it like this: $tagz = ...
3
votes
1answer
598 views

Remote upload file to server B

I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try. Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send ...
0
votes
0answers
4 views

Save the outputted image into the Media Library, with a different filename and extension

For example, I have this "/image.php" file in my "/theme-directory": header ('Content-Type: image/png'); $im = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); ...
0
votes
2answers
40 views

how to create shortcode in wordpress

So I have the following code: <span class="delete"><a onclick="return confirm('Are you sure?');" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'my-delete-product', ...
0
votes
1answer
29 views

I am Looking to append URL Parameter to all URLs

I am trying to add URL parameter to all the URLs of Wordpress website. This is for tracking affiliate sales by tracking links. E.g. I have put a link on another website ...
0
votes
0answers
18 views

Default Terms in Custom Taxonomy for Custom Post Types

I am using the below code to automatically assign a custom taxonomy (my_tax_name under my_tax taxonomy) to a custom post type (my_cpt) so that when I publish a post without assigning it any taxonomy, ...
0
votes
0answers
7 views

Custom Search Function adds Results to Navigation

I've added a custom search function on my site that allows terms of a custom taxonomy to be searched as well as the normal content. The function works just how it should, but when you get to the ...
0
votes
0answers
13 views

Add Custom fields to Quick Edit posts2posts

i am using posts2posts to connect 2 post types,and add custom field for each relation (many to many). I am looking for Quick Edit Option, here is my function <?php p2p_register_connection_type( ...
1
vote
1answer
33 views

Add custom function to a theme with child theme's functions.php

I am using a theme Indigo and have it working fine, in a child theme configuration. I want to add a custom function. Unlike the child style.css, I have read that you don't need to import the parent ...
0
votes
0answers
16 views

How to block specific external link without plugin

I want to block www.anafile.com - this site, in my WordPress blog site. When any user use this link in any blog post, on clicking "Publish" button, I want to block them posting or warn them. How can ...
-2
votes
0answers
23 views

Condition based on membership [closed]

My website about buy a membership VIP,SLIVER and GOLD click here I want to put condition to choose only one of the 3 type membership how and where I put ?
0
votes
1answer
1k views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
0
votes
1answer
37 views

Scrape external webpage for first image and add it to new post

I'm looking for a way to scrape an external page for its first/best/largest image and insert a copy of that image as the featured image of a new post on my Wordpress site. The way that I was hoping ...
1
vote
1answer
359 views

Can't get post ID in functions.php?

I need the current post id in a function , which I have written in functions.php. But I can't get the id . I have tried several method . Like get_the_ID() ; ----returns false global $post; ...
-1
votes
0answers
19 views

Running some php function from admin bar [closed]

I want to use my admin bar to run some functions from a plugin I developing. So far I managed creating top level menu item and submenu item in the admin bar. The submenu item should be usually linked ...
0
votes
1answer
320 views

Add content after get_header

I'd like to add content directly after the div#main (end of header.php) and before /div#main (beginning of footer.php). I'm using an own child-template (of twentythirteen), that contains only ...
0
votes
1answer
11 views

Wp Ecommerce Reposition Product Page Product Thumbnail Image

i want to reposition the product thumbnail of the wp ecommerce plugin product page product images. the default thumbnail function of wp doesnt seem to work add_image_size( 'product-thumbnail', 225, ...
1
vote
0answers
18 views

How to change permalink to include custom post type

Is there a way to add custom post type to permalinks with a plugin or otherwise? This is what I am trying to accomplish: mysite.com/projects/food/burgerking mysite.com/projects/wine/cherryvineyard ...
0
votes
0answers
25 views

Define an extra field for all pages (with no plugin?)

I usually use WP Types define custom fields, post types, ... But I have a theme a little bit overloaded of plugins, so I would like to define this field for (all) the pages in functions.php if ...
-1
votes
0answers
30 views

Send email from woocomerce as name from order ie:(first last <email.from@order.com>) [closed]

Im trying to integrate my CRM to woocomerce. My CRM lets me bcc my emails into the crm. But in order to create a person (not an email address) I need the email formated as follows: FirstNameFromOrder ...
0
votes
1answer
22 views

Alternative functions for mysql_free_result and mysql_ping in wordpress functions

what are the alternative function for mysql_free_result and mysql_ping in WordPress functions , does WordPress function provides all the functions like php ? is it necessary to Free result memory for ...
1
vote
0answers
19 views

mysql_real_escape_string() vs. esc_sql() in WordPress

Does mysql_real_escape_string() and esc_sql() in WordPress both do the same work? I tried following the following: $fetch_row='<p>And again for single posts</p>' echo ...
3
votes
1answer
4k views

Add container to nav_menu sub menu

Is there a way I can wrap a div around wp_nav_menu's ul.sub-menu So for example the markup would go from <ul class="menu"> <li><a href="/">Item 1</a></li> ...
0
votes
1answer
22 views

wp_delete_attachment

Im' trying to delete all attachments of a custom post type on post deletion using the before_delete_post hook. It works ok except that if I add another function to override the upload dir it doesn't ...
0
votes
0answers
17 views

Function to draw random image from specified category destroys site logic - why?

I'm trying to create a function in my child theme's functions.php file that will draw a linked image on every page. The link has to have a class, and the image must also have a class. The image is ...
0
votes
1answer
35 views

How do I register a new settings page? [on hold]

I need to be able to create a new settings page, one that will act as a list of information for the user. However, I am unable to find how to do this, can someone point me in the right direction for ...
0
votes
1answer
386 views

How to echo Widget Title in Custom Frontend-Template Box

I've created a custom Widget with the help of following code: // Creating the widget class wpb_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of ...
0
votes
2answers
1k views

Display Custom Field Value on Admin Page Column

What I want is to display the value of the custom field called 'page_template'. I use the code below but it displays nothing under Page Template column although I have already defined a value for the ...
0
votes
0answers
3 views

Dynamically PHP-generated content and SEO [migrated]

So I'm using a function in my functions.php file to add some text to all my posts. I was wondering if that will be used by Google when they index my website, and how that will affect my SEO ratings. ...
0
votes
0answers
28 views

preg_replace to switch urls

I've searched everywhere here and I just can not find the right setup; I'm trying to take a url and replace it with a non functional url... for example; CURRENT HTML URL STRUCTURE <a ...
4
votes
3answers
621 views

Dynamically add id to heading tags

How do I add an id attribute dynamically to every heading tag on a wordpress website using php? I wanted to make it so that for every heading tag (h1, h2, h3, h4, h5, h6) I have a unique id attached ...
0
votes
1answer
41 views

content editor format style tags

This is the code I'm using to generate format styles for content editor: // Callback function to filter the MCE settings function my_mce_before_init_insert_formats( $init_array ) { // Define ...
3
votes
1answer
4k views

adding a filter to a shortcode?

<?php echo do_shortcode('[mingleforum]'); ?> inserts the mingle forum into my content! is it possible to use add_filter() on that?
0
votes
0answers
19 views

Extract and amend variables from 'like' plugin and put into visual meter gauge plugin

I am trying to extract the total number of likes associated with different posts from the WTI Like Post Pro wordpress plugin, then subtract the number of unlikes and feed this total into a meter gauge ...
1
vote
1answer
860 views

Using PHP to toggle stylesheet and header image, set in cookie

I haven't done a lot of work with cookies or Wordpress before so I think I've been a bit over-optimistic in my quest :p I have created two themes for my site, night and day. I would like the user to ...
0
votes
0answers
11 views

Adding custom post formatting options in custom post types

I've added custom post formatting options using the below code - function wpb_mce_buttons_2($buttons) { array_unshift($buttons, 'styleselect'); return $buttons; } add_filter('mce_buttons_2', ...
0
votes
1answer
39 views

Remove Header and Footer in iframe

Many people embed my website's pages in their websites as iframes. I want them to don't take my footer, header and a specific division in those iframes. Since, footer, header and mentioned specific ...