Articles of php

truncating imported rss-feeds

this is a RSS-question: Im pulling an RSS feed from a site to display on my homepage. It displays the titles correctly, but I want to truncate the number of characters per post so it doenst take up a long section if the title is long. How do I do that? here is the code […]

How do you change the tag font size in the repeater-template.php

I am very new to WordPress and I am trying to change the font size in a custom theme from the repeater-template.php. I have the following: <?php the_tags(‘<li>’, ‘</li><li>’, ‘</li>’); ?> Can I simply add the font size in this way? <font size=”6″><?php the_tags(‘<li>’, ‘</li><li>’, ‘</li>’); ?></font> Thanks for your help, G.

woocommerce plugin bugs

I have some problems with displaying some values and I have no idea what I did wrong. <?php /* Plugin Name: Wallet for WooCommerce Plugin URI: Description: Wallet for a Client Version: 1.0 Author: InDeepTerror Author URI: */ include( plugin_dir_path( __FILE__ ) . ‘wallet.php’); include( plugin_dir_path( __FILE__ ) . ‘settings.php’); $wallet = New wallet(); add_action( […]

Ajax not updating to database

So I’m having a bit of difficulty getting user input to post to my database. Whenever I try to update the table, I am able to do it successfully on the front end, but on refresh, the data change does not stick. Checking the database further verifies that the data has not been changed… It […]

Customizer Show/Hide Logo and Site Title

I’ve setup checkbox controls in my theme Customizer to show/hide the Logo and Site Title when they are checked/unchecked. By default, I want the Logo to display and the Site Title to be hidden. Everything is working as it should except the Site Title won’t display in the live preview when the checkbox is checked, […]

Pull a div from one WordPress site into another WordPress site

I have 3 separate sites/installs on the same server and they all use the same database: xxxx.com/en xxxx.com/de xxxx.com/es I want a <div> from a specific site in xxxx.com/en to appear on the other sites. Let’s say I have <div id=”table1″>xxxx<div> on xxxx.com/en/page1; I want this to show on xxxx.com/de/page1. I did not think this […]

How can I call WordPress core functions in external scripts?

I’m trying to develop a code to call some Codex functions (https://codex.wordpress.org/Function_Reference) the problem is simple, I don’t find any doc where read about how to start. I have a PHP file with this line for example: <?php $website = “http://example.com”; $userdata = array( ‘user_login’ => ‘login_name’, ‘user_url’ => $website, ‘user_pass’ => NULL // When […]

Adding a number to a date

I confess… My php skills are bad. I’m trying to show an events duration within a post in an events category. Example: Oct 11-14 But I’m having a problem adding an integer to a date then printing it in the correct format. Please see my code below: <span class=”news-item-date-day”> <?php the_time(‘M j’); $event_length = get_post_meta […]

Add custom url to featured image

Good afternoon everyone, I have little experience in php programming and I have a problem with the featured images. Use Advanced Custom Field’s and create a field where i put a URL. Need when click in the featured image this take the URL of ACF and open in new tab. I found this code where […]

Cant get unique_array() work on get_the_category() foreach loop

i’m trying to list user’s posted categories (main ones only) on the author.php I have prepared this loop but it has duplicated content <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php $ar = get_the_category(); foreach($ar as $category) { if ($category->category_parent == 0) { echo ‘<p><a href=”?author_name=’.$curauth->user_login .’&cat=’.$category->cat_ID.'” title=”‘ . […]