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

t-servi.com on "hook to query the post_meta"

$
0
0

Hello,
I looking for the hook that can allow me to add some results of the post_meta table for a search query. I'll already try the pre_get_post and I write this code in a plugin:

function search_filter($query) {
  if ( !is_admin() && $query->is_search() ) {
  $s = get_search_query();
  global $wpdb;
  $querystr = "
        SELECT $wpdb->posts.*
        FROM $wpdb->posts INNER JOIN $wpdb->postmeta
        ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
        WHERE 1=1 AND ((($wpdb->posts.post_title LIKE '%$s%')
        OR ($wpdb->posts.post_content LIKE '%$s%')))
        AND $wpdb->posts.post_type = 'post'
        OR ($wpdb->posts.post_status = 'publish')
        AND ( ($wpdb->postmeta.meta_key = '_city_box'
        AND CAST($wpdb->postmeta.meta_value AS CHAR)
        LIKE '%$s%') ) GROUP BY $wpdb->posts.ID
        ORDER BY $wpdb->posts.post_title
        LIKE '%$s%' DESC,
        $wpdb->posts.post_date
        DESC";
      $pageposts = $wpdb->get_results($querystr, OBJECT);
    }
}
add_action('pre_get_posts','search_filter');

but when I look in the search.php page and try var_dump($wp_query->request)
the result of the var_dump don't give me the query I write.
Sorry for my missunderstood of wordpress. Can you help me?
Thank you.
Jean.


serviceweb on "Add new user role and edit page"

$
0
0

Hello i've create a new user role and i add capibilities to read, end edit page and read, create end edit custom post type.

I have a probleme becouse the user can't edit the page but can only read. Why? Where wrong?

/* aggiungi ruolo */

add_role('brokers', 'Brokers', array(
'read' => true, // True allows that capability
'edit_pages' => true,

));

AmarMiske10 on "Starting XI selector"

$
0
0

Hello.

I run sports website and I need app called starting XI (squad selector)

Is there codes so I can set up squad selector on my website, and after user create starting xi squad to share on social networks.

It doesn't look much complicated, this is like poll but more creative.

Examples:
Best:http://xi.statsfc.com/VsIkrxOyDBTSi1KkdIl7gdFb5dqjvOihsJ1PxVnN/3

http://news.bbc.co.uk/sport2/hi/football/teams/l/liverpool/squad_selector/default.stm

http://bhdragons.com/select-eleven-2/

Greetings
Amar

thatposhgirl on "Can't get color picker to work"

$
0
0

I'm trying to use the color picker in an admin menu for my plugin. I've followed the directs exactly as they appear here: http://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/

I've verified that my-script.js is linked on the page and url is correct.

I have this in my plugin's main .php file:

add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
function mw_enqueue_color_picker( $hook_suffix ) {
    // first check that $hook_suffix is appropriate for your admin page
    wp_enqueue_style( 'wp-color-picker' );
    wp_enqueue_script( 'my-script-handle', ECBS_JS_URL . 'my-script.js', array( 'wp-color-picker' ), false, true );
}

This is my-script.js:

var $j = jQuery.noConflict();
jQuery(document).ready(function($j){
    $j('.my-color-field').wpColorPicker();
});

My input tags that I want to use the color picker have the attribute class="my-color-field".

Nothing happens at all. No errors, nothing.

Any advice would be appreciated.

Pete on "How to display latest custom post of a specific custom post type"

$
0
0

I know nothing about php and I'm trying really hard to get this to work. I'm trying to display the latest custom post from a specific custom post type home-loan-news.

This is what i have so far...

<?php query_posts($query_string . '&orderby=menu_order&order=desc&count=1&post_type=home-loan-news'); ?><?php } ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Latest News: <a href="<?php the_permalink() ?>"><?php the_title(); ?></a><em><?php the_date(); ?></em> -
<?php the_content_limit(10,''); ?> <a href="<?php the_permalink() ?>">read more »</a>
<?php endwhile; else : endif; ?>

A solution would be hugely appreciated :)

sjmellor39 on "Add fields to login/register form"

$
0
0

I have a 'login required to view' site policy and I would like to modify the Register page on the login screen to include more user profile data. In my case, I would like to include the first name, last name and website in addition to just Username and E-mail.

You can see what I mean here:

With that said, I've been able to edit the register form itself to include (at the moment) the First name and Last name, but how do I get this user information submitted and stored into the database and viewable in the user profile?

Thoughts?

NeusGC on "How to redirect a homepage url to a subpage?"

$
0
0

Hi!

I've two wordpress sites one located on the root (www.domain.com) and then another wordpress site located on a subdirectory (wwww.domain.com/hola).

The first one is the main site we're working on, and the second one is a temporary site that has a poll to get to know users opinion.

So I want that, temporily, http://www.domain.com redirect to wwww.domain.com/hola and I've used the code below in htaccess to accomplish it. The problem is that this redirection doesn't allow me to access to the pages those I'm working on. For exeample I'm editing contact page and when I want to see it's draft (or published) version I'm redirected to a 404 error page.

Does anyone know what happens and could help me? Thank you very much!

Redirection used:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteEngine on
RewriteCond % ^matildabarcelona.com.com$
RewriteRule (.*) http://www.matildabarcelona.com/$1 [R=301,L]
RewriteRule ^$ hola [L]
</IfModule>

# END WordPress

Paxjah on "Submit user as post, using user login data, after register"

$
0
0

Hi there!

I'm trying to wrap my head around a problem and hope someone can help me with a logical solution.

I'm setting up 3 membership levels on my site; one is free and the other two are paid for.

The user registration form has the standard name, email, etc. but also a few custom fields.

Once either one of the paid-level users has input their data and hit 'register' their data is automatically submitted as a post (with related template and into related category) of their registration level. Essentially making their profile, if you will, the one and only post they submit to the site.

Ideally I'd also like them to be able to update their one post if they need to (so perhaps a small account panel for them).

What I was thinking was combining the following to accomplish this, but I have my doubts:

- WPMU Dev Membership Plugin
- Filtering the WPMU Dev registration form (to add the custom fields)
- Sidebar Login (any)

I'm sure I'm going about this in completely the wrong way, but if anyone has any suggestions I'd really appreciate hearing them :)


sparkss on "User Profiles Made Easy: Trying to order members by first or last name."

$
0
0

Hello, I am using the plugin User Profiles Made Easy and you are able to view all registered members. Right now the possible values for ordering that work are ID, login, nicename, email, url, registered, display_name, or post_count. I am trying to get it to be able to order by first or last name.

I know it has to do with this part of the code

// Setting up order data
        if (in_array($this->profile_order_field, array('nicename', 'email', 'url', 'registered')))
            $orderby = 'users.user_' . $this->profile_order_field;
        elseif (in_array($this->profile_order_field, array('user_nicename', 'user_email', 'user_url', 'user_registered')))
            $orderby = 'users.' . $this->profile_order_field;
        elseif ('name' == $this->profile_order_field || 'display_name' == $this->profile_order_field)
            $orderby = 'users.display_name';

  elseif ('firstname' == $this->profile_order_field || 'user_firstname' == $this->profile_order_field)
            $orderby = 'users.user_firstname';

        elseif ('ID' == $this->profile_order_field || 'id' == $this->profile_order_field)
            $orderby = 'users.ID';
        else
            $orderby = 'users.user_login';

And this part

c=b.addMenu({title:"Multiple Profiles / Member List"});
									a.addImmediate(c,"Group of Specific Users", '[upme group=user_id1,user_id2,user_id3,etc]');
									a.addImmediate(c,"All Users", '[upme group=all users_per_page=10]');
									a.addImmediate(c,"All Users in Compact View", '[upme group=all view=compact users_per_page=10]');
									a.addImmediate(c,"All Users in Compact View, Half Width", '[upme group=all view=compact width=2 users_per_page=10]');
									a.addImmediate(c,"Users Based on User Role", '[upme group=all role=subscriber users_per_page=10]');
									a.addImmediate(c,"Administrator Users Only", '[upme group=all role=administrator users_per_page=10]');
									a.addImmediate(c,"All Users Ordered by Display Name", '[upme group=all order=asc orderby=display_name users_per_page=10]');
									a.addImmediate(c,"All Users Ordered by Post Count", '[upme group=all order=desc orderby=post_count users_per_page=10]');
									a.addImmediate(c,"All Users Ordered by Registration Date", '[upme group=all order=desc orderby=registered users_per_page=10]');
                                                                a.addImmediate(c,"All Users Ordered by First Name", '[upme group=all order=desc orderby=first_name users_per_page=10]');
									a.addImmediate(c,"All Users showing User ID", '[upme group=all show_id=true users_per_page=10]');
									a.addImmediate(c,"Search Profiles", '[upme_search operator=OR]');
									a.addImmediate(c,"Search with Custom Field Filters", '[upme_search filters=meta1,meta2,meta3]');

This is the shortcode I'm using on the page

[upme_search autodetect=off filters=graduate] [upme group=all view=compact width=2 order=asc orderby=first_name users_per_page=8]

As you can see I have already messed with the code trying to add first name as an option to order as well. I have tried all kinds of combinations so far, but have had no luck. Any help in resolving this would be much appreciated. Thank you.

AliceWonderFull on "Custom page that is a webapp"

$
0
0

Hi, I don't do a lot of wordpress development, just one plugin so far.

Right now I am trying to port a simple calendar to WordPress that will live on its own page - e.g.

http://example.org/wordpress/calendar/

Basically I want - if possible (it certainly should be with mod_rewrite) the URI of the calendar to be configurable withing the WP plugin admin interface.

Adding events needs to be done through WP plugin admin interface.

It's the generation of the page from the plugin I can't figure out, what I keep finding in the docs is references to making custom templates but I don't want to make a custome template for a page, I want to use whatever template the site uses, and stick my generated calendar inside the div for content with whatever header and footer and aside columns the site already has.

What part of the WordPress documentation do I need to read?

not safe for work but not crude demo:

http://www.domblogger.net/puzzle/cal/

I just want that content stuffed in as the main content, I'm sure it is stupid simple to do, but I don't seem to understand WordPress lingo well enough to find how its done.

Blog Admin activates plugin, it creates the table and loads initial data. That I can find how to do.

Blog admin then goes to plugin admin page. That I can find how to do.

Blog Admin enters the relative URI where they want the calendar, and it that gets added to the blog menu as a link that when loaded, uses their existing template generating the calendar as the content - that's where I am stuck. As in I seem unable to find the WordPress documentation that covers that.

Thank you for suggestions.

DudeIsWack on "How Do I Get Header, Comments And New Comment Box All On One Page"

$
0
0

Hi all, I have a question I've given myself mouse-click-carpel-tunnel trying to solve and I hope someone can answer this question for me, as all the suggestions I have been able to find have not worked.

In Wordpress thirteen twenty, how can I make comments appear directly under the header on the main page without having to click on a link that says "view 3 comments" etc? I don't want there to be multiple pages, just my short intro and comments as you scroll down, with the post new comment box at the bottom, all on one page.

I had this figured out at one point, but for the life of me could not re-find the post on the net. It was something to do with entering something in a php file before 'endwise' and you had to change a 'count' number in the code line to enable multiple posts.

It worked for a couple of months, then I logged on one day to find the site crashed with an error message. I since rebooted the entire code, and got it back to the 2-page format, which I don't want. Any help anyone can give this codex ignorant hapless dude would be appreciated.

Thanks

dadako on "generate single pages based on custom meta?"

$
0
0

I'm trying to be as conservative as possible with my posts in a new wordpress site and let custom meta generate content across the site.

One of my custom meta tags is "video", in it I place a link to a youtube video that relates to the article.

The articles can be in one of three categories. Some don't have video so I query that up front.

As a result I can generate a category called "video", this page just lists any post with the "video" custom meta:

<?php
$recentPosts = new WP_Query();
$recentPosts->query('cat=1,2,3');
while ($recentPosts->have_posts()) :
$recentPosts->the_post();
?>
<?php if (get_post_meta($post->ID, "video", true)) : ?>
<a href="<?php the_permalink(); ?>"><?php the_title(''); ?></a>
<?php endif;?>
<?php endwhile; ?>

Clicking on the resulting link here will take a user to the post containing the video, so far so good. The post will be displayed in it's relevant category template.

However what I'd like to achieve is that when the link is clicked, the user is taken to an entirely new single-post template that displays the video meta data & title, but in it's own post format regardless of the category the post is in (not the category template).

Really not sure where to start, other than making separate posts for videos in their own category, which would be doubling up of data.

Any advice very welcome.

ferylee on "Category tags, exclude more than one category?"

$
0
0

Hi,
I have this beautiful code that prints the list of the categories which the post is assign to. I can exclude one category but now I need to exclude more than one... I try to put it in a array but somehow I don't know what I'm doing wrong.

<div class="cat_tags">
<?php
$categories = get_the_category();
$excluded_cat = '1';
$separator = ' / ';
$output = '';
if($categories){
	foreach($categories as $category) {
		if (
			$category->cat_ID != $excluded_cat
		)
			$output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator;
	}
	echo trim($output, $separator);
}
?>
</div>

Thanks for your help,
Fery

jwiere03 on "WooCommerce bulk order form"

$
0
0

I have seen some scripts that allow you to edit the order form on WooCommerce. I've done a bit of customization myself on WooCommerce but I'm having trouble figuring out how to do something like this http://www.classicnamerings.com/style1 for variable products. Any help would be appreciated.

ryanparrish on "Woocommerce + CategorytinyMCE"

$
0
0

Hello I am using Categorytiny MCE to add banners to the top of my category pages is there away to override the sidebars and make the banner images full width?

Example Page

Thank you for your time

Ryan


James on "how do i concatenate the string to allow for the site name to be completed dynam"

$
0
0

For my client sites i have a little developer plugin i have created, giving clients contact details etc, and cleaning up a few other WordPress things.... with this i'm trying to add a button to the WP Admin bar for clients to raise support requests, and struggling to add the `bloginfo(name)' to the email subject field (highlighted in bold below).... how do i concatenate the string to allow for the site name to be completed dynamically?

$wp_admin_bar->add_menu( array(
        'id' => 'support-request',                // an unique id (required)
        'parent' => 'custom-support-menu',           // false for a top level menu
        'title' => 'Raise Support Request',     // title/menu text to display
        'href' => 'mailto:support@emailaccount.com?subject=<strong>Client%20Site</strong>%20Support%20Request',
        'meta' => array( 'target'=>'_blank' ),  // target for link
    ) );

Advice and explanation very much appreciated

David Trounce on "Time and Date not showing in Posts"

$
0
0

Hi,

I have inherited a site that is not showing the time and date that a post was published.

I use a post in pages plug in for experpts and so understand that if I want the date there I must enter the shortcode, but on regular posts it is not showing up at all, only the author appears at the bottom of each post.

example: http://www.gfesport.com/wimbledon-tickets-and-tournament-hot-up-for-2014/

I would like to display time, date and author under each post.

Thanks for any help.

Theme is Hot Sportal (Child). And the WP is 3.9.1

elove1920 on "Creating a dropdown order form on picture"

$
0
0

I am new to creating anything more than a very basic website. I am trying to place a dropdown ordering menu on pictures on my site so that people can choose different sizes. We do collages so I also need a way to add different pictures to a group so that they can choose what pics to put on the collage. Also, I need to know if it automatically updates the choices in the cart or if I need to connect the dropdown menus to the cart. I don't have an example, but I can get one if it is needed. Anyone willing to help a newbie?

anyone88 on "Add a custom url rewrite rule to wordpress"

$
0
0

Hi wordpresscommunity,

I'am trying to add a custom URL rewrite to my wordpress-site. When %25% is in located in the url, I want to forward to index.php (dont ask me why ;)). The correct rewrite I stumbled across is:

add_rewrite_rule('^(.)%25%(.)$','index.php', 'top');

I red that the url rewrite has to be added as a plugin. My plugin looks like this:

<?php
/**
* Plugin Name: Custom url rewrite
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: custom url rewrite
* Version: 1.0
* Author: Henk
* Author URI: http://URI_Of_The_Plugin_Author
* License: GPL2
*/
function init() {
add_rewrite_rule('^(.)%25%(.)$','index.php', 'top');}

It doesn't do anything after being activated! not even after flushing my url rewrites. What do I do wrong?

Thanks!

HansVanEijsden on "Apply ImageMagick sharpen filter to all images"

$
0
0

I would love to apply sharpening to all my images, because (as you probably know) after resizing all images need sharpening to stay crisp.
I have installed ImageMagick and also the PHP function, everything works fine.

What I need is:
$this->image->unsharpMaskImage(0 , 0.5 , 1 , 0);

Those are the perfect sharpening parameters for all of my images.

More about unsharpMaskImage here:
http://www.php.net/manual/en/imagick.unsharpmaskimage.php

I know there's a plugin, https://wordpress.org/plugins/sharpen-resized-images/ - but that plugin turns everything back to GD - which strips EXIF data and color profiles. So, that plugin is no option for me, I really want to use ImageMagick.

Where and how can I implement that unsharpMaskImage filter? Thanks!

Viewing all 8245 articles
Browse latest View live




Latest Images