Questions tagged [php]

For questions about the server-side programming language that the WordPress core, plugins and themes are written in. Questions about using PHP outside a WordPress context are off-topic but might be asked on Stack Overflow.

Filter by
Sorted by
Tagged with
-2
votes
1answer
1k views

Wordpress portfolio pagination on home page

I am new to wordpress i am trying to add pagination to my home page that shows portfolios, example there are total of 80 portfolios when i open my site it automatically shows all 80 portfolios on home ...
-2
votes
1answer
229 views

Pagination not working properly

I have a list of posts from a category as seen here in this example. The problem is, if you scroll down to the bottom and click older, you'll see that the posts on the page have not changed at all, ...
-2
votes
1answer
107 views

Detecting IP Address of someone using 'copy' function [closed]

Is it possible through WordPress (through a plugin, PHP or otherwise) to detect the IP of someone copying (ctrl+c) content on my website, and have that data sent/displayed to an admin? Appreciate ...
-2
votes
1answer
159 views

Display biography post for today's birthday person

I am new in the WordPress Theme development, i am building a website using WordPress that is specially for biographies posts. I have one section called "Today's birthday", in this section i wanted to ...
-2
votes
1answer
46 views

php grabbing every post made?

Uh oh! So I added a page-blog.php with the following code: <article> <?php // Display blog posts on any page @ http://m0n.co/l $temp = $wp_query; $wp_query= null; $wp_query = ...
-2
votes
1answer
499 views

Functions.php file in a custom child theme messed up without backup

I just ran into some problem. I'm a beginning Wordpress dev. I don't know much and I have messed up my functions.php file. Here's how it happened: I copied the code from This site. This was supposed ...
-2
votes
1answer
886 views

How to echo css class for a link? [closed]

I am trying to add a css class to this link in a plugin I am using. The plugin has the following code - echo "<a href=\"" . get_permalink() . "\">"; The css class I'd like to add is class="...
-2
votes
1answer
219 views

probleme adding Txt and Links in preg_match()

I'm newbie in PHP, i use this PHP code who work as a charm (@Brian Fegter) : add_action('template_redirect', 'foobar_explode_if_no_citation'); function foobar_explode_if_no_citation(){ #Get the ...
-2
votes
2answers
61 views

Two sites one PC

after this problem I think that there is a problem if I have two wordpress installation on one pc. I've fallow this instruction and the only thing is that I've change the wp-contents folder like this ...
-3
votes
1answer
4k views

paginate_links() returns NULL instead of the pagination links, but pagination is actually happening

What I'm trying to do: Print the pagination links on the home, which uses template index.php, with pagination functions such as paginate_links(), outside The loop. What happens instead? Instead of ...
-3
votes
1answer
68 views

What is proper way to use the php if statement? [closed]

Nothing is displayed on the page. Using PHP 7.0 WordPress, Text area of a page. What am I missing? My code: <!DOCTYPE html5> <html> <body> <?php if (1<2) { echo "Add ...
-3
votes
1answer
3k views

is it possible to create cart functionality without woocommerce? [closed]

I was wondering about how I can create custom cart functionality without installing WooCommerce plugin. Is it possible?
-3
votes
1answer
194 views

PHP if url extension action=discussion condition use [closed]

I want use some style only for url extension /?action=discussion How can I use it by PHP condition?
-3
votes
1answer
697 views

php snippets in html are being commented out

when i try to add an element to a site, that contains a php snippet, it is commented out and not working: function phpTest() { return "<p><?php echo 'some text';?></p>"; } ...
-3
votes
1answer
4k views

Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\admin\products.php on line 148 [closed]

<tr> <?php include('sql_connect.php'); ?> <?php $sql="select * from hp"; $query=mysql_query($sql); if(...
-3
votes
1answer
29 views

get user role. parameter id return type string [closed]

function user_role_parameter($user_id){ global $connection; $query = "SELECT * FROM users WHERE user_id = $user_id "; $the_user_id = mysqli_query($connection,$query); while($row = ...
-3
votes
1answer
124 views

Please help to know why single.php crashes after I add this code [closed]

This is my single.php. I'm using the Suffusion theme and the Advanced Custom Fields plugin. I'm trying to display custom fields based in a specific post category. The code works fine if I remove the ...
-3
votes
1answer
38 views

What does this if-statement do?: if($pages=' ') {}

This is an excerpt from a tutorial on how to create pagination for an blogpost overview page. What does the first part if($pages == '' exactly do? Quote from tutorial: Now we know which page we ...
-3
votes
1answer
640 views

Please help! Parse error: syntax error, unexpected '<' in blog code, no idea how to fix it! [closed]

This is currently the code: <?php //* Start the engine include_once( get_template_directory() . '/lib/init.php' ); //* Enqueue scripts and styles add_action( 'wp_enqueue_scripts', '...
-3
votes
1answer
933 views

Can you not edit the HTML and PHP of your WordPress without paying?

Sorry for the noob question. I'm new to WP. I'm not seeing where I can edit the HTML and PHP of my blog. I see a bunch of GUI options to change colors, etc. but nothing to change my blog's source ...
-3
votes
3answers
237 views

Really slow WordPress site [closed]

I am almost done creating a website running with WordPress and WooCommerce. Unfortunately, the site is loading really, really slow. Loading a page easily takes 8-10 seconds. I have 33 WordPress ...
-3
votes
1answer
199 views

Retrieve Array from within Array [closed]

I have an array being created within another array in Wordpress and I need to get the ID value from each Array. This is the code I am using to pull the array <?php $pages = get_field('products'); ...
-3
votes
1answer
88 views

$_html is empty when var dumped

So I have run across a bizzar issue, in which I know is working as i expect it to in terms of the array values, yet the _html variable returns something like string(29) " " which to my knowledge ...
-3
votes
1answer
39 views

How to improve wordpress site creation process to increase productivity.

more info: we are all here working and loving WordPress but at the end of the day we need to make money if we can finish same work in less time we can be more competitive and take more projects in ...
-3
votes
1answer
143 views

Adding a script & php to functions.php

I usually work with javascript and never php. My task is to add this script/php code to woocommerce. <?php $ImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id( $loop->post->ID )...
-3
votes
2answers
77 views

$post->ID calls for current page, but what is the code to call for any new page created and published in WordPress?

While there may be another or better way to do it, all I need is this last snippet to make this do exactly what I need. So, I hope anyone here can and is willing to help me get it working as I need? ...
-3
votes
3answers
622 views

Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel

I deleted everything in my directory to "start over" When I install wordpress it says : Your PHP installation appears to be missing the MySQL extension which is required by WordPress. I tried changing ...
-3
votes
1answer
316 views

How can I fix my pagination?

I'm trying to get pagination working on my custom wp_query post loop. I currently have it set up, but when I click on page 2, it shows the exact same posts from page 1. I have a total of about 8 posts ...
-3
votes
1answer
211 views

How to create shortcode of this PHP code

I tried a lot but failed to create shortcode of this PHP snippet: <ul> <?php $my_query = new WP_Query('post_status=future&order=DESC&showposts=10'); if ($my_query->have_posts()) { ...
-3
votes
1answer
3k views

How to increase excerpt length in wordpress? [duplicate]

Thank you for your help! functions.php function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$...
-3
votes
1answer
161 views

Insert PHP into wordpress page [duplicate]

I want to use the following code in my wordpress page. How can I do that? <?php $theme_name = get_template(); $directory = "wp-content/themes/" . $theme_name . "/pdf/ECE340/"; $pdfs= glob($...
-3
votes
1answer
107 views

Are WordPress & PHP objectively and based on evidence going to die because the future is made of frontend rendering instead of server side rendering? [closed]

A friend called Pablo told me to learn WordPress CMS but another friend called Lucas told me to learn Strapi CMS because server side rendering and PHP in general are dying in favor of frontend side ...
-3
votes
1answer
3k views

Advanced Custom Fields Show PHP in Text Areas

I recently installed and configured my ACF fields. However, I found out that when I include PHP (ex. <?php the_field('field_name');?>) in a custom field on the admin panel, the PHP only shows up ...
-3
votes
1answer
19 views

Event plugin problem any one solve .? [duplicate]

bool(false) object(stdClass)#5590 (3) { ["price_struct_id"]=> string(2) "11" ["product_id"]=> string(4) "1294" ["display_order"]=> string(1) "0" }
-4
votes
2answers
39 views

Not able to see the error [closed]

My website receives this error when going to the home page: Parse error: syntax error, unexpected 'endif' (T_ENDIF) in /home/wha2wearco/wha2wear.com/wp-content/themes/pro-blogg/index.php on line 63 ...
-4
votes
1answer
60 views

how to Show BEFORE TEXT before in wordpress get_comment_meta [closed]

I am using a piece of code to show the city output. It is working fine. The code is given here: $city = get_comment_meta( get_comment_ID(), 'city', true ); I want to show Re: text before the output ...
-4
votes
1answer
367 views

What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]

function custom_scripts_css_with_jquery() { //wp_register_script( 'Bootstrap_min_js','//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js' ); wp_register_script( 'jquery', 'https://...
-4
votes
2answers
1k views

Force array to be a string [closed]

Im using a charts plugin an i need to force some array elements to be strings. $values_x = array(); for ($i = 0; $i < count( $series[0]['data'] ); $i++ ) { $values_x[] =...
-4
votes
1answer
2k views

How to remove the intro animation which appears during the load up of some Wordpress themes? [closed]

How do you find and delete the code which makes the loading animation at the very start of every page on many wordpress sites appear? Sometimes the animation is a simple loading wheel gif image and ...
-4
votes
2answers
5k views

Adding jquery using php function

I was turned down with this question because I get a php error and my question revolves around jquery, but when I take out the JQUERY everything works fine. * Again I'm creating a wordpress plugin. I ...
-4
votes
2answers
69 views

New to WordPress & Freelancing [closed]

I'm new to WordPress and a little confused with how it works. I have made basic websites in the past with HTML, CSS, JavaScript - you know the 'regular' way. Anyways, I've been looking into ...
-4
votes
1answer
3k views

Running a php code after User clicks a button? [closed]

Objective: User clicks a button to subscribe to a Tag on the Tag Archive page. I am using the current code: <?php $tag_id = get_query_var('tag_id'); $...
-4
votes
1answer
1k views

How to hide .js files on wordpress website using php or wp plugins or any? [closed]

How to hide my script files in wordpress. I tried this idea from this blog // include a javascript file echo "<script type='text/javascript'> /* All your javascript code goes here */ </...
-4
votes
1answer
9k views

Add a “Next Post” & “Previous Post” styled button manually to a post

Can anyone walk me through the exact steps? I want to create two buttons that sit next to each other at the bottom of a post for the NEXT and PREVIOUS posts...I want to be able to insert this ...
-4
votes
1answer
53 views

How do I link the side images?

This is my site: http://classichits.ie/ I want to link the background image to another page. This is the code I have so far: body.boxed-layout { background-image:url(<?php echo get_site_url();...
-4
votes
1answer
2k views

How to send push notification in android using php? [closed]

I want to send android push notification from php. I have created admin in php & mysql when admin approve anything from admin than send notification to user.
-5
votes
4answers
5k views

How to store the_post_thumbnail() value in a variable

As you know the result of the the_post_thumbnail() is an image tag. I need this image tag to store at a kind of collection or Array. I'm using the following code but it doesn't help me out. And I want ...
-5
votes
1answer
841 views

Echo get_option displays as text

I am trying to use some code that is stored as a settings option in WordPress. When I try to use the following code below however, it show up as plain text instead of executing. The option I have ...
-6
votes
1answer
3k views

Undefined variable in functions.php file [closed]

I'm new to php and I'm trying to figure out why the following error is occurring: Notice: Undefined variable: post in functions.php on line 59 Here is my functions.php code: <?php // related ...

1
188 189 190 191
192