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

dgcov on "Post Meta Data: How does it work?"

$
0
0

I'm Designing a post type with 3 membership levels:

Master, Member and Viewer.

The Master can manipulate the post content in the database, the Member has restricted access and the Viewer has read-only access.

I'm adding the information by the way of meta data:

update_post_meta( $post_id, '_membership', array('master'=$userID) );

What I want is to be able to tell what level of access the current user has. Obviously the 'master' will have only a few entries, the 'member' will have a lot more and the 'viewer' will have loads more still.

The problem is that the documentation suggests that updating the meta data will overwrite all the values in the array.

What would be the best way of handling this?


Kouin on "WooCommerce Full Width Page"

$
0
0

It seems this question has been asked in large, but for some reason no one seems to have found an answer - or if they have it isn't for the current versions. I've tried just about everything out there with no results.

I have managed to remove the sidebar from all WooCommerce Pages, but now the pages are stuck at 70-some percent width. It looks awful.

I've tried editing CSS, editing files, making a new default template for woocommerce.php. No results.

Ideas, anyone?

doolezah on "Filter the Categories Widget by limiting categories to one term of a taxonomy"

$
0
0

I would like to create a custom Categories widget that lists only the categories found in posts belonging to a specific term from a taxonomy. I have created a new custom categories widget that extends the default Categories widget, but I cannot figure out how to set the arguments to limit the results. I have tried multiple approaches to setting up the arguments, but to no avail.

Does anyone have any suggestions?

Also, to help think about this, each taxonomy term is an area of interest similar to a newspaper section. Those taxonomy terms have a 'home page' that should have all sidebar items filtering out any sibling or parent terms and showing only the ones within posts to the section. I appreciate the help!

Lsnewton on "Filtering out a taxonomy from the admin post list."

$
0
0

I have a custom post type ('speakers') and a custom taxonomy ('archived') that is applied to several of those custom posts, which allows me to move them into different places on the front-end of the site.

I can create a dropdown filter on the edit.php post list screen, similar to the pre-existing 'post date' one, that lets me see only those posts with the 'archived' taxonomy applied to them. (See code below).

What I'd like to do is invert this filter, so that an admin can hide any posts with that taxonomy from the post list, simplifying the screen and letting them focus on all of the other posts instead. How would I do this?

add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy');
function tsm_filter_post_type_by_taxonomy() {
	global $typenow;
	$post_type = 'speakers';
	$taxonomy  = 'archive_status';
	if ($typenow == $post_type) {
		$selected      = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
		$info_taxonomy = get_taxonomy($taxonomy);
		wp_dropdown_categories(array(
			'show_option_all' => __("Show All {$info_taxonomy->label}"),
			'taxonomy'        => $taxonomy,
			'name'            => $taxonomy,
			'orderby'         => 'speaking_date',
			'selected'        => $selected,
			'show_count'      => true,
			'hide_empty'      => true,
		));
	};
}
add_filter('parse_query', 'npc_convert_id_to_term_in_query');
function npc_convert_id_to_term_in_query($query) {
	global $pagenow;
	$post_type = 'speakers';
	$taxonomy  = 'archive_status';
	$q_vars    = &$query->query_vars;
	if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
		$term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
		$q_vars[$taxonomy] = $term->slug;
	}
}

Ritzbits8 on "Woocommerce + Lightspeed POS Integration"

$
0
0

I am putting together an e-commerce site for a client, using woocommerce. This client has a POS through Lightspeed. Woocommerce offers a plugin that will integrate his POS with woocommerce in real time.

My client has a table of rates set A-G on his Lightspeed Account (More you buy, the lower the price). But the plugin does not include a table of rates to integrate with woocommerce.

I need either some custom code, which I'd be willing to learn but don't know where to start. Or perhaps someone reading this has an easier/cost friendly solution to this problem.

Thanks

imanewbe on "Add Custom Type to Menu Page"

$
0
0

I have added a custom link section to the menus page by doing the following:

add_meta_box('gallery_meta_box', __( 'Galleries' ), array(__CLASS__, 'render_add_galleries_nav_menu'), 'nav-menus', 'side', 'default' );

public static function render_add_galleries_nav_menu(){

	global $daybreak;

	$galleries = $daybreak->get_galleries( 999 );
    ?>
    <div id="gallery-archive" class="posttypediv">
        <ul class="gallery-tabs add-menu-item-tabs">
            <li class="tabs"><?php _e( 'Galleries' ); ?></li>
        </ul>
        <div class="tabs-panel tabs-panel-active">
            <ul class="categorychecklist form-no-clear">
            <?php foreach ($galleries as $key => $gallery ): ?>
                <li>
                    <label class="menu-item-title"><input type="checkbox" class="menu-item-checkbox" name="menu-item[-<?php echo $key; ?>][menu-item-object-id]" value="<?php echo $post_type->name; ?>"> <?php echo $gallery->title; ?></label>
                    <input type="hidden" class="menu-item-title" name="menu-item[-<?php echo $key; ?>][menu-item-title]" value="<?php echo $gallery->title; ?>">
                    <input type="hidden" class="menu-item-url" name="menu-item[-<?php echo $key; ?>][menu-item-url]" value="<?php echo $daybreak->get_gallery_url($gallery); ?>">
                    <input type="hidden" value="custom" name="menu-item[-<?php echo $key; ?>][menu-item-type]">
                </li>
            <?php endforeach; ?>
            </ul>
        </div>
        <p class="button-controls">
            <span class="add-to-menu">
                <input type="submit" class="button-secondary submit-add-to-menu right" value="Add to Menu" name="add-gallery-menu-item" id="submit-gallery-archive">
                <span class="spinner"></span>
            </span>
        </p>
    </div>

<?php }

This works fine. I can add these items to the menu but when I do they are added as a "Custom Link" I want to add them as a "Gallery". If I change the menu-item-type to 'gallery' then they do not get added to the menu and the page throws a JS error.

Is there some way to do this?

mlgeorges on "Colleting public social data of my users"

$
0
0

Hi
I would like to know if there is a plugin to collect public social data of my users for instance
- Facebook : nb of likes, nb friends
- YouTube : nb of videos, views and followers
- Instagram : followers and posts
...
By any chance do you know if such plugin exist ? if no can someone develop that for me ?
Thanks,
ML

hmortensen2907 on "How to get an array of topmost menu items?"

$
0
0

Hi all,

I'm trying to make a top level menu only, for a special page.

But I simply can figure out how to get an array of the top-most menu items, or a array of them all? Then I hope I can pick the ones without parents? or?

I found the following code, but no matter what I insert into $menu_name it returns "not defined"..

$menu_name = 'nav-menu';

    if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {
	$menu = wp_get_nav_menu_object( $locations[ $menu_name ] );

	$menu_items = wp_get_nav_menu_items($menu->term_id);

	$menu_list = '<ul id="menu-' . $menu_name . '">';

	foreach ( (array) $menu_items as $key => $menu_item ) {
	    $title = $menu_item->title;
	    $url = $menu_item->url;
	    $menu_list .= '<li><a href="' . $url . '">' . $title . '</a></li>';
	}
	$menu_list .= '</ul>';

    }
	else
	{
		$menu_list = '<ul><li>Menu "' . $menu_name . '" not defined.</li></ul>';
    }
	echo '<div>' . $menu_list . '</div>';

I'm new to the workings of the internal workings of the menu system, so please, be specific :)

Any help would be appreciated,

- Henning


cantonjester on "Handling Fee Plugin"

$
0
0

I downloaded a free plugin that allows for you to add a custom handling fee at the product level, and then it appears in the calculation breakdown in the shopping cart/checkout.

Fatal flaw is that (I think) the handling_fee field wasn't assigned an appropriate data type to account for any values to the right of the decimal point, because when you enter 5.50 for handling on the product page, only "5.00" appears in the shopping cart.

I have the php file open and I'm tinkering around in it. I've changed the input type from text to number, and added step "0.01", but that's not affecting how the value appears in the shopping cart.

It's the 'WooCommerce Dynamic Handling' plugin.

Any ideas?

nikola797992 on "Wordfence plugin with wp rocket"

$
0
0

Can I use wordfence together with wp rocket?

tinnedsoup on "Random website appears on GA but I can't find it in posts or pages"

$
0
0

So basically on my google analytics I looked at the pages section and I noticed a random website link which has a lot of views. This site has no page on my blog, it doesn't have a post and I don't understand where it has come from.

My url is tinnedsoup.com

I can't find it to get rid of it, the plugins I have are Instagram feed, Google analytics, Jetpack, Mashshare buttons, Mojo, Twitter, WP importer and WP super cache

Has anyone else had this problem?

Thanks

pgrimes1980 on "Exclude category/categories from blog roll"

$
0
0

I feel like I have to be missing something, I thank you in advance for your guidance and for your patience as I'm sure this isn't the first time this has been addressed. I've read what I can but after spending almost 3 hours on what I'm sure will be a few simple tweaks I'm throwing myself upon the mercy of the community.

I have my blog posts displayed on a page, using a static home page. I want to exclude specific categories from showing up with the rest of the posts.

I found this really helpful post but there are some things in play that I don't think apply to my setup and/or the current version of WordPress. The loop doesn't seem to be contained within index.php. Instead my theme has loop.php which is called from index, if I'm reading the code correctly. I've experimented with putting the WP_Query line before the loop in loop.php AND before loop is called in index.php and both have failed me miserably.

Please help me understand what I'm doing wrong here and how to resolve the issue. Any insight or guidance is appreciated.

My Site: http://2dorksontheroad.com
Using theme: Travel in Italy

Cosmopull on "Remove first image permanently"

$
0
0

How i may permanently remove first image from posts ?
I know at least two ways to disable them, for example this one

function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');

and another one with css
display:none

But i want to permanently delete first images with Mysql query, because hiding images as described above continue braking website markup. If i manually delete image from post, then markup displayed normally.

Mindiscover on "How save my rank while transferring the url"

$
0
0

I have an old wordpress.com site with the url http://www.hebrewtourguidetokyo.com

I bought this domain a new host to rebuild him on wp.org, and gave the old site my old domain which is hebrewtourguidejapan.com.

Now I need to 301 redirects all the pages from the other domain (japan) to the main domain (Tokyo).

btw, I changed the pages name so it won't be same address (/..)

Can someone please can explain that to me in a language I can understand?

Thanks

Rad199 on "Shortcode rendering above div that is put in"

$
0
0

Hello everyone,
I've managed to create a custom post plugin and now I am trying to display the data using custom shortcode.
I understand that shortcodes work with return instead of echo/print. I am just wondering if anyone knows why the content gets displayed above the div I've put it in. It only happens when I display data from the database ( the_content() ). If the $output is only a string that I've typed manually, it works. What is wrong with the code?

Any help is much appreciated!

//[sustainability-plugin]
function sus_func( $atts ){

    $output = '';
    $args = array( 'post_type' => 'sustainability_post', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );

    $output .= '<div class="wrapper">';
    while ( $loop->have_posts() ) : $loop->the_post();
    $output .= '<div class="content">'. the_content() .'</div>';
    endwhile;
    $output .= '</div>';

    return $output;

}
add_shortcode( 'sustainability-plugin', 'sus_func' );

Repox on "Extending Woocommerces shipping method"

$
0
0

Hello.

I'm currently in the process of trying to implement a shipping method in Woocommerce allowing the user to select a parcel shop or direct delivery based on their location.

The parcel shops are being fetched via an external API.

I've gotten to the point where I successfully can select the shipping method I've created.
Now I'm stuck at the point of presenting additional selections based on the user selecting my shipping method. In my mind, I'm looking for something that will create a radio button group that has selections that looks like the following:

[ ] Delivered directly to your address (a static option)
[ ] Delivered to Parcel Shop XXX (Dynamically fetched from API after address lookup)
[ ] Delivered to Parcel Shop XXX (Dynamically fetched from API after address lookup)
[ ] Delivered to Parcel Shop XXX (Dynamically fetched from API after address lookup)

I have absolutely no idea where to look to get this done.

heart2hack on "add custom field in add new post section"

$
0
0

hello everyone.
i want to display a custom field within the add new post using a plugin which i want to code.and i don't know how i can display my custom created field in the add new post section of the user with permission of admin to editor.

the custom field should use by admin to editor except subscriber.i want to accomplish this.insert a field and than data from the field with post id and post feature image should be inserted to a new table which my plugin will create.

i need help, to do so.i am beginner in plugin development and try to create plugin to get extra functionality for my site.
thank you.
best regards.
hasan.

CoBu1 on "The function wp_dropdown_users() seems to break my site."

$
0
0

I'm trying to restrict the users in the post editor's "authors" dropdown to users with the custom role of "welder".

But the wp_dropdown_users() function seems to break my site (the post editor never loads). When I remove the function, everything goes back to behaving normally.

function ls_authors_dropdown($output) {

	$welders = get_users( array(
		'role' => 'welder',
		'fields' => 'ID'
	));

	$args = array(
		'include' => $welders,
	);

	$output = wp_dropdown_users($args);

	return $output;

}

add_filter( 'wp_dropdown_users', 'ls_authors_dropdown');

Opeymd on "Thousands of products imported from ebay need categorized"

$
0
0

I am putting together a store for a antique business that has over 30,000 items in inventory and 10,000 active items listed on eBay.

We are using Woocommerce for our store along with with 2 other main plugins, WP-Lister (to publish to eBay) and Import from eBay to Woocommerce (to import all of our inventory from eBay)

Once all of our inventory is imported, we then have to categorize all of our products.

By default I set products to import into a category called "china" for now.

(I have only tested this method with about 200 products to start. It gets really difficult to keep track of everything I have already placed in a category.)

1) How can I keep track of what still needs categorized?

Here is the problem and an example.

"CHINA" and 'ANTIQUES" are two of our main categories I am working in. They are subcategories of /invt/

-China
-- Manufacturer(s)
--- Pattern(s)

All the products I previously placed in the subcategories of china load when I select the china category in the products view. It seems that it is going to be impossible to keep track of what still needs categorized.

We would arrange all the products into categories and subcategories in ebay first then import them into the "China" category, but it would end up pointless because eBay only allows you to create 300 sub categories and we are going to possibly end up with thousands of subcategories.

And... when our products are imported from ebay, most of them are imported with a category called "other" (because it imports the ebay "store" categories) even though they are imported into the china category.

So aside from it being difficult to keep track of what is categorized, when I do a bulk edit in our products to put them into the right categories, they are still in the "other" category unless i edit the product itself instead of doing a bulk edit. I can do a bulk edit but then need to go into the products one by one and deselect "other".

Any Ideas on this topic would be greatly appreciated!

spartanlocke on "Metaslider custom css not working"

$
0
0

What it says when I inspect element:

.metaslider .caption {
padding: 5px 10px;
word-wrap: break-word;
}

Now I want to change the padding. When I change it indirectly via inspect element, it works. When I copy it over to style.css it doesnt work. Am I missing a selector here?

By the way I am doing this via localhost, so I wont be able to link my site. Sorry for that. Just starting out.

Viewing all 8245 articles
Browse latest View live




Latest Images