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

onyudo on "What's the best way to directly link to a post's file attachment?"

$
0
0

I have a portfolio where there are a series of thumbnails. Clicking on a thumbnail leads to the portfolio post's permalink (i.e., the_permalink(); ). Attached to each portfolio post is a PDF file.

What is the most direct way to link the thumbnail directly to the PDF file attached to the portfolio post?


Jumpringer99 on "Make a page title in two colors"

$
0
0

I want page titles of three specific pages to display two colors.

The solution may be a php statement replacing a string with css.

I've tried this several times with no luck... for example:

<?php
$myPageTitle = get_page(244));
$myPageTitle = str_replace(array('...that', '<span>...this</span>'), '', $myPageTitle);?>
<?php echo $myPageTitle; ?>

Suggestions welcome....thanks.

Unsober on "Mass Publishing Posts"

$
0
0

Hellow, Guys.
I need some help with clear one thing. I need to publish all of my posts( 15.000) at once. I try some scripts with changing post_status to "publish", but it's not the same as button "Publish" in editing post.
If some one knew how to code this, pls ans.
Thanks.

diggim8 on "A very complex or simple?: One WordPress with many domains"

$
0
0

Somehow the modern book of answers (google) failed me for the very first time, i will come back to why in a sec.

MY STORY:
It first started with an opportunity given to me, some guys needed help with their wordpress site.
Sure I make websites in wordpress and know some basic html & css but nothing too advanced but OK i said! no problemos.

Ususally, your own problem has already been someone else problem before it was a problem for you. (i thought)

So .. I’ll google it!

After some intense research a friend calls me and I’ll decide to ask my friend for a solution.

I tell him:
I got this really complex problem. I need different domains on each post category for my blog!:S

He tells me:
- LOL thats really easy! You just go to permalinks and pick a name for each category! xD

My answer:
.... ehm. -.-

MY SITUATION:
- I have one primary domain (w~w.awsomeblog.com)
- and 3 more domains. (w~w.superman.com) (w~w.batman.com) (w~w.peter-griffin.com)
- One wordpress installation (newest).
- 3 post-categories containing articles (posts)
- Pretty permalinks

I use the blog for writing superman, batman and peter-griffin articles ,
(as 3 post-categories)

w~w.awsomeblog.com/superman/article
w~w.awsomeblog.com/batman/article
w~w.awsomeblog.com/petergriffin/article

But I wanna make use of my domains
(w~w.superman.com) (w~w.batman.com) (w~w.peter-griffin.com)

w~w.superman.com/article instead of w~w.awsomeblog.com/superman/article etc etc

Having domains for each category, working prettylinks and NOT using multisite, I told my friend.

Beacuse when I did my google research the resluts get mixed up with setup multisites with different domains - in my case there is a single WP installation (not multisite).

My friends answer: GL HF

SO MY QUESTION TO YOU:
I did understand I could make use of .htacess and I also read some about redrict / rewrite but its not really clear.

1. What solution fits my problem? (i need to keep pretty permalinks)
2. How to point the other domains? if I have the domains at same hosting company as WP install
3. How to point the other domains? if I have domains at other regstar.

I am very muchos grande appreciated for your very assistance in this matter!

PS: sorry to dissapoint but im not really writing a superman blog.

Piotr on "Using one function for two scheduled events and a form"

$
0
0

I think this is going to be difficult to explain, but I hope someone will understand. ;)

I'm building a plugin that queries data from a non-Wordpress database (a forum) and inserts it into Wordpress as custom posts. Thanks to the help of bcworkz in this topic (Thx!) I managed to create a function that does this and scheduled an event that uses this function once every hour to import any new posts created on the forum or update any edited posts. It's alsp assigning different categories to posts from different forum sections - so, I can say I'm quite happy with my first Wordpress plugin, but obviously I want it to do more. ;)

What I want to do is to use Wordpress options to change what the plugin does. I want it to do three things and I need to control some parts of them. Here's how it should work:

1. A scheduled event will import/update ALL posts from SELECTED forum sections once a day.
2. A second scheduled event will import/update a SELECTED NUMBER of latest posts from SELECTED forum sections once every hour.
3. A form will let me execute the import function to update ONE SELECTED post (let's say in case it's older than the posts which are updated every hour).

Scheduling events isn't a problem for me, neither is setting options - I already created options panel and I'm able to save options into Wordpress database. What I don't know is how to pass these options into my function depending on which event is fired. I still consider myself a newbie in PHP, so maybe the solution is simple and I just can't see it. What I think I have to do is to use variables in the WHERE clause of SQL SELECT statement of my import function. Right now it looks like this:

WHERE forums.id IN (61, 62, 63) ORDER BY topic.id DESC LIMIT 5

I think in case of my daily event it should look like this:
WHERE forums.id IN ($forum_ids) ORDER BY topic.id DESC
This will let me change or add forum sections without editing the code if my forum would have to be reorganized somehow in the future.

And in my hourly event it should look like this:
WHERE forums.id IN ($forum_ids) ORDER BY topic.id DESC $limit
So I could change the number of updated posts.

The third case is different and it's not the WHERE clause that is the biggest problem - it will be one topic.id. The problem is it appears I can't use the Setting API to execute a function. I would have to connect a form in my admin panel to my import function so that when I type in the ID and hit the submit button, the function is executed - but again, I don't know how to do it.

So in short, I need to know how to pass different number of options (one in case of the daily event, two in case of the hourly event and again one in the third case) and how to do it. Unless the whole idea is wrong, and there is a better way. I also need to know how to create the form that executes my plugins function.

I'll be grateful for any advice.

zvonano on "No access to page some period (need code)"

$
0
0

Hi everyone,

I was wondering how to make code for my Wordpress page... When I open one page, and then when I close it, how to make that I can`t open it again for some period (for example 30 minutes).

Thanks in advance for your answers.

walshie1987 on "Woocommerce - How are the attribute tables generated?"

$
0
0

Hi All,

I'm really struggling with this one.

I've installed Woocommence and I've made a few mods to certain tables and written a few scripts to update them which are working fine.

I want to tidy up the admin panel so I can edit the info here instead of having to log into myphpadmin to update the tables.

What I'm having problems with is:

I log into wordpress admin and click on Products -> Attributes, I then click on "Configure Terms" on one of my terms and i'm taken to the next page displaying a list of all of my attributes (e.g. /wp-admin/edit-tags.php?taxonomy=pa_colour&post_type=product).

This page has a table in with the headings "Name", "Description", "Slug" and "Products". I want to add my column info into this which is called "Includes". This column is location in table wp_term_taxonomy which the above info is also stored in.

I'm ok with PHP but I simply cannot figure out where the headers and info for this page are generated.

Any help would be much appreciated!

Cheers
Chris

israelj5 on "php if statement"

$
0
0

I'm having trouble figuring out a way to show my logo under my h1 header ONLY on my home front page. I want to display a navigation menu in my current logo's location on all other pages. If anyone could help me, that'll be cool. Thanks

My website is:
http://www.gustavoxvargas.com


ameraz on "Modifying Post Type Archive Query"

$
0
0

Im using the following code to modify the 'posts_per_page' parameter of a Custom Post Type & Custom Taxonomy Archive, problem is that it is also modifying the Main Blog Page (is_home) query:

function list_all_posts($query) {
	if ( !is_admin() && $query->is_main_query() && ( is_post_type_archive('custom_post_type') || taxonomy_exists('custom_taxonomy') ) ) {
		$query->set( 'posts_per_page', '-1' );
	}	}
add_action('pre_get_posts','list_all_posts');

Have also tried:

function list_all_posts($query) {
	if ( !is_admin() && $query->is_main_query() && !is_home() && ( is_post_type_archive('custom_post_type') || taxonomy_exists('custom_taxonomy') ) ) {
			$query->set( 'posts_per_page', '-1' );
	}	}
add_action('pre_get_posts','list_all_posts');

I only want to change the query of the Custom Post Type & Custom Taxonomy Archive and leave the default Main Blog Page intact so 'Blog pages show at most' can be modified in Settings > Reading as it normally would.

Any help would be very much appreciated.
Cheers!

Rcalonge on "Plugins not running jquery"

$
0
0

Hello, I am developing my own theme from scratch but I am quite new in this.
I installed the plugin "Drag & Drop builder" from Themify and I tried to insert a image slider, but apparently it's not loading the javascripts or jquery files from this plugin because it is just showing the pictures one above the other, without any effect.
The same happens when I use the plugin "codecanyon-1362246-layerslider-responsive-wordpress-slider-plugin"
Both plugins used within another theme are working properly.

This is my functions.php:

<?php

add_theme_support('post-thumbnails');

define('TEMPPATH', get_bloginfo('stylesheet_directory'));
define('IMAGES', TEMPPATH. "/images");
define('FONTS', TEMPPATH."/fonts");

add_theme_support('nav_menus');

if(function_exists ('register_nav_menus'))
{
	register_nav_menus(
		array('main' => 'Main Nav')
	);
}
 if (function_exists('register_sidebar')){

 	register_sidebar (array(

 		'name' => __('Primary Sidebar', 'primary-sidebar'),
 		'id' => 'primary-widget-area',
 		'description'=> __('The primary widget area', 'dir'),
 		'before_widget'=>'<div class="widget">',
 		'after_widget'=>"</div>",
 		'before_title'=>'<h3 class="widget-title">',
 		'after_title'=> '</h3>',

 	) );

 }
function my_init() {
	if (!is_admin()) {
		// comment out the next two lines to load the local copy of jQuery
		wp_deregister_script('jquery');
		wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, '1.3.2');
		wp_enqueue_script('jquery');
	}
}
add_action('init', 'my_init');
 ?>

[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

I would appreciate so much if someone could help me.

Thanks!

cyclopse on "Shortcodes not working"

$
0
0

Hello i am using company theme and in that i added visual composer but when i added a tabs shortcode it showing tabs but not showing the content of the tabs but when i switch to default theme it start working kindly help me out.

stackaruk on "How to edit wp-activate.php"

$
0
0

Currently when I add a new user account they are directed to wp-activate.php This page currenly has all the web pages listed and linked. I would like to get rid of this and maybe customize the message. Any ideas where I should start?

bsapaka on "how to modify core function the_meta()"

$
0
0

I am trying to modify the_meta() so that numeric custom fields are displayed with commas and dollar signs.

Where do I modify the core function without changing the core file? Do I use functions.php?

Ray@swaggest.com on "How to have TAGS show on my posts"

$
0
0

Hello everyone,

I'm trying to find a way to have TAGS show up on my entries.
For example, if you see this page http://www.swaggest.com/lego-the-simpsons-set/
you can see the category "live" right under the title. I want to be able to put the TAGS right next to the category.

My theme (Apollo) allows me to put a tagcloud on my widgets.
This means my theme is somehow pulling the tags from the tags I add during the post. I just have to find a way to get it onto my posts instead of into a tagcloud instead.

My single post .php shows this.

<header><h1 id="post-title"><?php the_title(); ?></h1></header><!-- #post-title -->

                <ul class="meta clr">

                     <?php
                     // First category link
                     $category = get_the_category();
                      if( $category[0] ){
                          echo '<a>term_id ).'">'.$category[0]->cat_name.'</a>
<li>';
                      }

                     // Comments link
                     if( comments_open() ) { ?>
                        </li>
<li></li>

[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

I'm assuming if I can make a new line that says "get the tag" with some coding it'll work!

Someone please help me!

Mads Phikamphon on "Plugin upload, location of the readme.txt file"

$
0
0

Hi,

I have uploaded a plugin (http://wordpress.org/plugins/adv-stopwatch/), but for some reason wordpress.org cannot find my readme.txt

So can anyone tell me where in my /trunk/ etc. file structure I should put the readme.txt to make wordpress.org find it?

Currently I have it in /trunk/ and I have commited, but it still doesn't format the plugin description etc.

Thanks,
Mads


moocow1452 on "Curating Posts on Geolocation"

$
0
0

Hello there all, I'm new to Wordpress, have a little more of a handle on PHP, but am currently in a bit over my head.

So, I agreed to help my friend with a PHP addon to Wordpress that allows you to take Geotagged information off a post, check them against the user's location, and curate a list for Feedblitz to send a newsletter into a subscriber's inbox for local posts only. As I understand it, Wordpress can geotag posts from stock, and plenty of Map APIs can sniff the user's location and crosscheck the two, but I could use a hand on my options either starting from scratch or pulling from another plugin.

charlyanderson on "Add additional menu"

$
0
0

I ALWAYS struggle with WP Menu's, just can't get my head around them....

I am working on a theme that only supports one menu so I need to add an additional menu.

The menu code is:-

<?php $args = array('container' => 'nav','container_class' => 'sidemenu','walker'=>new ows_walker_nav_menu); ?>
<?php wp_nav_menu($args); ?>

Function code:-

/* ========================================================================================================================

	Register Navigation

	======================================================================================================================== */
register_nav_menu('main', 'Main navigation menu');
class ows_walker_nav_menu extends Walker_Nav_Menu {

	// add classes to ul sub-menus
	function start_lvl( &$output, $depth ) {
	    // depth dependent classes
	    $indent = ( $depth > 0  ? str_repeat( "\t", $depth ) : '' ); // code indent
	    $display_depth = ( $depth + 1); // because it counts the first submenu as 0
	    $classes = array(
	        'sub-menu',
	        ( $display_depth % 2  ? 'menu-odd' : 'menu-even' ),
	        ( $display_depth >=2 ? 'sub-sub-menu' : '' ),
	        'menu-depth-' . $display_depth
	        );
	    $class_names = implode( ' ', $classes );

	    // build html
	    if ($display_depth >= 1) {
	    	$output .= '<nav class="sub-menu-container">' . "\n";
	    }
	    $output .= "\n" . $indent . '<ul class="' . $class_names . '">' . "\n";
	}

	function end_lvl( &$output, $depth ) {
    // depth dependent classes
    $indent = ( $depth > 0  ? str_repeat( "\t", $depth ) : '' );
    $display_depth = ( $depth + 1); // because it counts the first submenu as 0
    $output .= "\n" . $indent . '</ul>' . "\n";
    if ($display_depth >= 1) {
    	$output .= '</nav>' . "\n";
    }
  }
}

I have tried to change this a few times but the theme either breaks or the change doesn't work. Could someone help me out and point me in the right direction please

dgstr on "Exporting WordPress User List"

$
0
0

I need to export my wordpress' users list to Zoho CRM or Google Docs.

Is there any way to do this?
I have already searched a lot, and found Wordpress and Zoho integrations, but no one about exporting user data.

Is possible to do this?

Thanks!

desseloch on "WP_Option to big for "srb_" raw"

$
0
0

Dear all,
I've a big problem with WP_OPTION table in my DB , that become very big 100MB automatically in 6/7 days.

There are to many row like these:

option_id option_name option_value
123580 srb_d2b5edba8b3d12ab66fda1c857e02eae 2:{s:2:"ts";i:1391775925;s:5:"value";s:4979:" ht...

How can I solve ?

Thank you,
Cristiano

5ngua on "changing uploads folder in an old wordpress site"

$
0
0

Hi,

By saying old wordpress site I want to mean a wordpress site that already has posts with image published. Now I want to rename and move the uploads folder to the subdomain. I use wordpress multisite install.

My concern is how I can do that smoothly without breaking published posts and images. Do you know any solution for this?

Thank you.

Viewing all 8245 articles
Browse latest View live




Latest Images