Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

ivanweb on "Translations list on the plugin page"

0
0

Hello!

Could you please help me to understand - how I can change list of available translations on the plugin page in the repository?

I have published plugin https://wordpress.org/plugins/popup4phone/ , in the /lang/ sub directory it contatins .po and .mo files for Russian and German translation.

However translations list in the right column on the page https://wordpress.org/plugins/popup4phone/ contains only Russian translation, while German translation not appeared.


makemewise on "Printing new line with plugin"

0
0

Hello, I have this plugin, that allows me to echo what python prints

<?php # -*- coding: utf-8 -*-
/* Plugin Name: test */
header('Content-Type: text/html; charset=cp1252');
add_shortcode( 'test', 'execute_python_with_argv' );
function execute_python_with_argv(){
ob_start();
$description = array (
    0 => array("pipe", "r"),  // stdin
    1 => array("pipe", "w"),  // stdout
);
$application_system = "python ";
$application_path .= plugin_dir_path( __FILE__ );
$application_name .= "test.py";
$separator = " ";
$application = $application_system.$application_path.$application_name.$separator;
$pipes = array();
$proc = proc_open ( $application , $description , $pipes );
if (is_resource ( $proc ))
{
    $var= stream_get_contents ($pipes [1] ); //Reading stdout buffer
}
echo "<br>".$var."<br/>";
$output = ob_get_clean();
    return $output;
}

So the question is, if python prints 123(each number in the different line) why is this plugin printing in same line? How do I make it to print to separate line? Thank you.

TIEro on "How do I paginate a custom user list?"

emilkos on "get value from cart total or subtotal"

0
0

Hi,
I use the module for calculating delivery by local carrier,but the module do not calculate shipping costs to the total.
In the "wp-content / plugins / woocommerce / templates / order / order-details.php" I added the following code to take the amount of shipping and subtotal:

'<? php $ a = array (
get_post_meta ($ order_id, 'Order_subtotal', true),
get_post_meta ($ order_id, 'Econt_Customer_Shipping_Cost', true));
?>
<tr class = "total-cost">
<th> <? php _e ( 'Total:', 'woocommerce'); ?> </ Th>
<Td> <? php echo array_sum ($ a); ?> <? php echo get_woocommerce_currency_symbol (); ?> </ td>
</ tr>'

As a result, I get only the value of "Econt_Customer_Shipping_Cost", but not from "Order_subtotal" to get the total.
Please if someone can tell me what to use to get a subtotal.

bbirchmeier on "Keep add to cart button on certain category in shop loop"

0
0

Hello!

For my shop I need to have all items in one category (KMC Product) to not have an Add To Cart Button when I am logged in. Below is the code I used to do that:

function kmc_buy_buttons(){

$current_user = wp_get_current_user();
    /**
     * @example Safe usage: $current_user = wp_get_current_user();
     * if ( !($current_user instanceof WP_User) )
     *     return;
     */

   $product = get_product();
   if ($current_user->ID >= 3){

   if ( has_term('kmc-product', 'product_cat') ){
       // removing the purchase buttons

       remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
       remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

       remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );

       remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );

       remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );

       remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );

       }

   }

}

add_action( 'wp', 'kmc_buy_buttons' );

However, there is one item in the shop loop that is in the KEO Product category. It appears in that loop because the page lists all Dovetail HSS products, which that item is a part of. The item also doesn't have an Add to Cart button, though it should.

http://www.keocutters.com/product-category/milling-cutters/shank-type/dovetail-cutters/45-single-angle/hss-45-single-angle/page/2/

tofuwarrior on "Can I execute a function to save a text file on save/update of a wordpress menu"

0
0

Hi,

I am trying to integrate a wordpress menu into magento and am wanting to save a text file with the relevant menu information every time the menu is saved so that my magento function can just access this text file to get the menu items html rather than make a database call every time.

Is this possible and is this a good solution?

I am using the magento wordpress integration plugin (what was the james kemp one) NOT fishpig one in order that I can then use wordpress properly so it is not possible to use the fishpig approach where I can access the wordpress menu easily in magento.

Many Thanks,

Paul

sa_ostad on "What is Best Delete Policy without foreign-key on Delete CASCADE"

0
0

I use MySQL as Database Management System , But it doesn't have foreign-key support by default configurations in WordPress.
So My question is in case of parent-child relationship what is the best solution when we want to delete parent records?

mrez0 on "Purpose of conditional check WP_USE_THEMES inside upgrade.php"

0
0

Hello, I am just studying the core of wordpress and I struggled with this conditional check which is mentioned in wp-admin/includes/upgrade.php:

if ($oldfile == 'index.php') {
    $index = implode('', file("$oldpath/$oldfile"));
    if (strpos($index, 'WP_USE_THEMES') !== false) {
        if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile"))
            return false;

	// Don't copy anything.
	continue;
    }
}

What is the purpose of this check "if (strpos($index, 'WP_USE_THEMES') !== false)"


janbrokes on "Conflict of search page and category page"

0
0

Hi,

this part of code I added to index.php page

<h1 class="pagestitle"><?php echo(get_category_parents($cat, TRUE, ' ')); ?> české návody</h1>
<div id="vypis">
<?php
if (is_category()) {
$this_category = get_category($cat);
}
?>
<?php
if($this_category->category_parent)
$this_category = wp_list_categories('orderby=id&show_count=0
&title_li=&use_desc_for_title=1&child_of='.$this_category->category_parent.
"&echo=0"); else
$this_category = wp_list_categories('orderby=id&depth=1&show_count=0
&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID.
"&echo=0");
if ($this_category) { ?>

    <?php echo $this_category; ?>

<?php } ?>
</div>

in order ho have fine H1 and list at category page f.e. here
http://www.ceske-navody.net/bosch/

But it causes problem in search here:
http://www.ceske-navody.net/?s=bosch

Is there any way how to selve it? For example add some condition tha will restrict that part of code at search page?

Thanks in advance
Jan

testerdodo on "Auto Generate Chart in WordPress Posts"

0
0

I'm using WP REST API to publish contents for my website. Is it possible to generate chart and insert into posts by coding?

I tried Visualizer Library but did not know how to do it automatically by coding. Please advice!

worldsdream on "Debug true, WP TAG CLOUD showing me error"

0
0

Hi everyone,

I have TAG-CLOUD enabled in my widget, for more information:
https://codex.wordpress.org/Function_Reference/wp_tag_cloud

I have added this code to my functions.php (child theme)

add_filter( 'widget_tag_cloud_args', 'my_widget_tag_cloud_args' );
function my_widget_tag_cloud_args( $args ) {
	$args['number'] = 34;
	$args['order'] = rand;
	//$args['exclude'] = array(20, 80);
	return $args;
}

In my error log it's showing error on line 10, it's this one:

$args['order'] = rand;

Why am I getting this error? It's working correct on my website, the tags are getting randomized

Thank you

kerican on "format array code for orderby post__in"

0
0

Hi all,

I've tried altering the orderby code in WPTiles to display gallery photos in a specific order.

This is what I've tried so far that doesn't work. I'm not sure I'm formatting the array correctly.

[wp-tiles post_type="jetpack-portfolio" post__in=(87,84,110,109,86,83,82,85,88,157) orderby="post__in"  order="ASC" grids="Golden Ratios" full_width="true"]

<hr />

[wp-tiles post_type="jetpack-portfolio" orderby="date" order="DESC" grids="Golden Ratios" full_width="true"]

The first section is my attempt at setting up the array for post__in.
The second section is the original code.

Here's the test page I created to try out WPTiles:

Tiled Gallery Test Page

Thanks for your help!

CCeliaS on "How do I postpend an anchor tag to get_permalink in this function?"

0
0

Hi all,

I'm stuck. I'm working on a site that has a Parallax Banner that takes up most of the screen height.

I'm trying to modify the function that creates my "read more" links after my excerpts in my Recent Posts to link to the #content id in my single.php (opening the page after the tall banner).

I'm using the suggestion from the Codex on Customizing the Read More, (see below) but I don't know enough .php to be able to insert the anchor tag (#content) that I'd like to postpend to the get_permalink without breaking the code.

// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
       global $post;
	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read More...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');

http://sottovocepress.com/brian/ and http://sottovocepress.com/brian/ashley-madison-hackers-come-together-to-fight-marital-infidelity/

Thoughts?

Many thanks in advance!

lwoods on "Code placement for loading in specific page"

0
0

I have an "include" that loads a PHP script that contains some enqueues. I originally put my 'include' in the top of my template for the page but I found that the code didn't get loaded because it looks like "template load" time is too late in the load sequence. I moved the 'include' to my functions.php and all works fine BUT I don't want to load all of this code for all pages---which is what happens with the 'include' in functions.php. BUT, I discovered that in functions.php I don't know what the page is that is being loaded.

Any ideas?

Guido on "Delete my custom upload directory on uninstall"

0
0

Hi,

I'm developing a plugin that hooks into the upload_dir filter: it creates a custom upload folder in folder wp-content.

But how can I delete whole folder again, when uninstalling plugin? I would like to add this in my uninstall.php.

Guido


devwaleed on "Using wp_users and wp_usermeta"

0
0

Hi, I am working on a website. It has a custom registration system where visitors have to register to use the service. How should I save those registrations? Should I use WP's users table or should I create a new table for that?

venomphil on "Qualifiedourspecialoffer.com Green Overlay Hack?"

0
0

Hi WordPress,

Recently i've been experiencing this popup on my site and cant see where it has come from? Its not something I can seem to replicate easily as it doesn't seem to come up at every visit? Has anyone else seen something like this?

Screenshot

Thanks

thintin on "Help implementing 'simple pagination' plugin"

0
0

Hi.

I've been trawling through themes and plugins for about a thousand years now just trying to turn my post pagination into big buttons instead of the default 'easily missed' text.

I think I've found a plugin that will do what I want but I'm having trouble locating the code that I need to replace in order for the plugin to work.

The plugin is: Simple Pagination
My WP site is: http://www.tuckshopmemories.com

The instructions for the plugin say do this:-

Usage for posts

In your theme, open the theme files where you'd like pagination to be used. You need to find calls to next_posts_link() and previous_posts_link() and replace them.

Usually this is the loop.php file.

You would replace those two lines with this:

<?php if(function_exists('wp_simple_pagination')) {
wp_simple_pagination();
} ?>

but I can't find those files because my theme doesn't have a loop.php file.

Help?

kaleelkr on "Get post count of original author"

0
0

Hello.

In my news website author have to change author to a common name. is there any way to get post count of original author.

itock on "WP Custom Post Type Backend View"

0
0

0
down vote
favorite

I have created a Custom Post Type with the Custom Post Type UI plugin.

I have added a number of custom fields which are connected to this custom post type.

I want to create a Backend View for the custom post type where the user can see the post without the ability to Edit the post.

I need help on the following issues:

Overriding the 'View' button shown for every entry to point to the 'Backend View' page
Creating the 'Backend View'

The Custom Post type that I have created isn't shown through the website it is meant as Booking, each Booking input is added as a post entry, which currently can only be viewed in Edit mode. Which creates a problem as I want the edit mode to be available to 'Super' Admins only.

Apart from the above the View button which is automatically shown for each entry directs you to the homepage, I want this to be either overriden and directed to a View page or completely removed so to not confuse the users.

Viewing all 8245 articles
Browse latest View live




Latest Images