Articles of php

How to use functions

I have installed the plugin WPdeposit on my site, it allows users to deposit into their account balance. I am trying to manipulate users balances when they press an anchor tag on the page. In the directory plugins/models/user.php there are many functions, I think im interested in this one: /** * Update Regular balance to […]

How can I use custom menus with a Bootstrap WordPress theme?

I have this ‘primary’ menu with a few items in the CMS, which I can list nicely with this PHP code: $args = array( ‘theme_location’ => ‘primary’ ); wp_nav_menu( $args ); The PHP outputs the menu with the <ul> tag. but, I want to use HTML that looks like this: <ul class=”nav navbar-nav”> <!– primary […]

Custom User Registration script only allowing usernames with 16 characters

I’m noticing a weird issue on a custom User Registration page I’m using in WordPress. It seems as if WordPress will only accept usernames with 16 characters (NO MORE, NO LESS). The custom registration form asks for First Name, Last Name, Email Address and a Number. To prevent duplicate Usernames, the username is generated by […]

<a> with PHP within splits the link

I’ve finally found out how to call a the project-type in a link so the link changes depending on which page it shows. This is the code: <h3 class=”widget-title”> <a href=”../”>Terug naar <?php the_terms($post->ID, ‘fluxus-project-type’); ?></a></h3> But what happens now is the following. Both ‘Terug naar’ and the result from ID, ‘fluxus-project-type’); ?> get split. […]

Foreach implode issue

I have this piece of code that gets the values of meta boxes in WordPress. $guiones = rwmb_meta( ‘mb_guionistas’, array( ‘multiple’ => true) ); $pieces = array(); foreach ($guiones as $item) { $pieces[] = ‘<a href=”‘ . bloginfo(‘url’) . ‘/?p=’ . $item . ‘” title=””>’ . get_the_title( $item ) . ‘</a>’; } echo implode(‘, ‘, […]

Create a a form for custom taxonomy terms

Currently i am displaying a list of my custom taxonomy (contenttags). These are displayed in a list using the code below, which then displays the posts under that taxonomy. <?php $taxonomy = ‘contenttags’; $terms = get_terms($taxonomy); // Get all terms of a taxonomy if ( $terms && !is_wp_error( $terms ) ) : ?> <ul> <?php […]

JS file is not loading when i put wp_head() and wp_footer

In my WordPress project I need to use a WordPress plugin, For that plugin to work I have to put wp_head() and wp_footer(). But when I put that than my slider’s JS file don’t load. <script src=”<?php bloginfo(‘stylesheet_directory’);?>/layout/scripts/tabslet/jquery.tabslet.min.js”></script> Any idea how I can load my JS file with wp_head() and wp_footer Functions. The slider which […]

Get URL of Featured Image After wp_insert_post()

I want to get the url of a featured image. I’ve created a function with wp_insert_post to post data and set a featured image for them. Everything works fine except displaying the url of featured image. Here is my code : $newpostname = $movie[‘title’]; global $wpdb; $id_ofpost_name = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE post_name […]

PHP Output also in Child theme, but different

I have a multilingual site setup: The main dutch version uses Fluxus. On the artwork page I output a link using this from Functions.php function prefix_term_name($terms, $post_id, $taxonomy ) { foreach ($terms as &$term) { $term->name = ‘Terug naar ‘.$term->name; } } return $terms; And on the page itself I show it using this: […]

custom stripe plugin

I am using some code that I found at pippins plugins for integrating stripe into wordpress. I have some custom functions I need to run after a payment is made. The code works great except for one thing: When I add a a webhook to stripe it fails with a 302 error. Here is the […]